Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 3
0
		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);
		}
Exemplo n.º 4
0
		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);
		}