no message

master
zcy 2023-01-25 00:33:57 +08:00
parent 319ea4a679
commit 3afd2af811
2 changed files with 12 additions and 10 deletions

View File

@ -221,5 +221,3 @@ func TestPortDocVersion(t *testing.T) {
}
}

View File

@ -38,7 +38,7 @@ func TestVariableNameChange(t *testing.T){
}
func TestSpeed(t *testing.T){
var tcpAddr *net.TCPAddr
tcpAddr,_ = net.ResolveTCPAddr("tcp","192.168.5.133:7")
tcpAddr,_ = net.ResolveTCPAddr("tcp","192.168.6.103:6500")
conn,err := net.DialTCP("tcp",nil,tcpAddr)
@ -48,18 +48,22 @@ func TestSpeed(t *testing.T){
}
defer conn.Close()
recv := make([]byte,1024)
recv := make([]byte,128)
i := int32(0)
for ;i < 128;i++ {
recv[i] = byte(i&0xff)
}
fmt.Println(conn.LocalAddr().String() + " : Client connected!")
reportTime := time.Now()
speed := 0;
for {
cnt,e := conn.Write([]byte("123456"))
cnt,_ := conn.Write(recv)
speed += cnt
_,e = conn.Read(recv)
if nil != e{
log.Print(e.Error())
}
// cnt,e = conn.Read(recv)
// if nil != e{
// log.Print(e.Error())
// }
// speed += cnt
if(reportTime.Add(time.Second).Before(time.Now())){
reportTime = time.Now()
t.Log("speed ",speed," B/S")