public void Send() { if (m_socket == null) { return; } IOSocket io = new IOSocket(); io.WriteInt32(NetMsgDefine.HeadBeat); io.WriteByte(1); m_sendEventArgs.SetBuffer(io.GetBuffer(), 0, io.GetLength()); m_socket.SendAsync(m_sendEventArgs); }
public void SendHello(string str) { IOSocket io = new IOSocket(); SayHelloStruct say = new SayHelloStruct(); say.msgtype = NetMsgDefine.sayhello; say.str = str; io.WriteInt32(say.msgtype); io.WriteString8(say.str); //var buffer = new byte[1000]; //Array.Copy(buffer2, buffer, buffer2.Length); m_sendEventArgs.SetBuffer(io.GetBuffer(), 0, io.GetLength()); m_socket.SendAsync(m_sendEventArgs); }