예제 #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));
        }
예제 #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));
        }
예제 #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);
		}
예제 #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);
		}