internal static int SendDisconnected(NetBase netBase, string reason, NetConnection connection) { NetMessage bye = new NetMessage(NetMessageType.Handshake, reason.Length + 3); bye.Write((byte)NetHandshakeType.Disconnected); bye.Write(reason); return(netBase.SendSingleMessageAtOnce(bye, connection, connection.RemoteEndpoint)); }
internal static int SendConnectResponse(NetBase netBase, NetConnection clientConnection, IPEndPoint remoteEndpoint) { double now = NetTime.Now; ushort nowEnc = NetTime.Encoded(now); NetMessage response = new NetMessage(NetMessageType.Handshake, 3); response.Write((byte)NetHandshakeType.ConnectResponse); response.Write(nowEnc); clientConnection.m_firstSentHandshake = now; clientConnection.m_lastSentHandshake = now; return(netBase.SendSingleMessageAtOnce(response, clientConnection, remoteEndpoint)); }
internal static int SendDisconnected(NetBase netBase, string reason, NetConnection connection) { NetMessage bye = new NetMessage(NetMessageType.Handshake, reason.Length + 3); bye.Write((byte)NetHandshakeType.Disconnected); bye.Write(reason); return netBase.SendSingleMessageAtOnce(bye, connection, connection.RemoteEndpoint); }
internal static int SendConnectResponse(NetBase netBase, NetConnection clientConnection, IPEndPoint remoteEndpoint) { double now = NetTime.Now; ushort nowEnc = NetTime.Encoded(now); NetMessage response = new NetMessage(NetMessageType.Handshake, 3); response.Write((byte)NetHandshakeType.ConnectResponse); response.Write(nowEnc); clientConnection.m_firstSentHandshake = now; clientConnection.m_lastSentHandshake = now; return netBase.SendSingleMessageAtOnce(response, clientConnection, remoteEndpoint); }