Today, I did a test to see if server A in LAN is transmitting data through a connection to Server B, and it is different from multiple connections.
Results found and how many connections do not matter, a process a connection can run full network card, as long as the write time is fast enough, read time is fast enough. 1000m network card, TCP can run to 910m
Here are the programs written by Golang:
Server
Package Main
Import (
"FMT"
"NET"
"OS"
)
Func Main () {
L, Err: = Net. Listen ("TCP", OS. ARGS[1])
If err! = Nil {
Fmt. Println ("Error Listening:", err.) Error ())
Os. Exit (1)
}
Defer L.close ()
Fmt. Println ("Listening on:" + OS. ARGS[1])
for {
Conn, err: = L.accept ()
If err! = Nil {
Fmt. Println ("Error accepting:", err.) Error ())
Os. Exit (1)
}
Go HandleRequest (conn)
}
}
Func HandleRequest (Conn net. Conn) {
BUF: = make ([]byte,209715200)
for {
_, ERR: = conn. Read (BUF)
If err! = Nil {
Fmt. PRINTLN (ERR)
Return
}
}
}
Client
Package Main
Import "NET"
Import "OS"
Import "Log"
Import "StrConv"
Func Main () {
Conn, Err: = Net. Dial ("TCP", OS. ARGS[1])
i64, err1: = StrConv. parseint (OS. ARGS[2], 10, 32)
If Err!=nil {
Log. PRINTLN (ERR)
}
If err1!=nil{
Log. Println (ERR1)
}
200m=209715200
var array = make ([]byte,i64)
for {
Conn. Write (array[:])
}
}
Socket transfer single link and multi-connection test results between servers