Пример #1
0
func main() {
	for i := 1; i < 2000; i++ {
		session = tcplib.TcpClientCreate("127.0.0.1:8000", OnDataReceive, OnClientClose)
		wpk := packet.NewWpacket(packet.NewByteBuffer(1024), false)
		wpk.PutString("selloword")
		session.Send(wpk, OnSendFinish)
	}
	fmt.Println("...")
	for {
		time.Sleep(1 * 1e9)
	}
}
Пример #2
0
func main() {

	session = tcplib.TcpClientCreate("127.0.0.1:8000", OnDataReceive, OnClientClose)
	wpk := packet.NewWpacket(packet.NewByteBuffer(1024), false)
	wpk.PutString("client")
	wpk.PutString("502301")
	session.Send(wpk, OnSendFinish)
	echo := packet.NewWpacket(packet.NewByteBuffer(1024), false)
	echo.PutString("this is echo ~")
	session.Send(echo, OnSendFinish)
	fmt.Println("...")

	for {
		time.Sleep(1 * 1e9)
	}
}