/// <summary>Reconnects the client to the server by sending them a new welcome verification.</summary>
        /// <param name="clientID">The client identifier.</param>
        /// <param name="packet">The incoming packet.</param>
        /// <remarks>This function sends a "WelcomeVerification" packet.</remarks>
        public static void ClientReconnect(int clientID, Packet packet)
        {
            int id = packet.ReadInt();

            PacketSend.WelcomeVerification(id);

            ValidatePlayerID(clientID, id);
        }
Exemple #2
0
        /// <summary>Connects the specified client to the server. Initializes the receive buffer and socket.</summary>
        /// <param name="clientsSocket">The clients socket.</param>
        /// <remarks>This function sends a "WelcomeVerification" packet.</remarks>
        public void Connect(TcpClient clientsSocket)
        {
            socket = clientsSocket;
            socket.ReceiveBufferSize = bufferSize;
            socket.SendBufferSize    = bufferSize;

            byteStream = socket.GetStream();

            dataIn        = new Packet();
            receiveBuffer = new byte[bufferSize];

            byteStream.BeginRead(receiveBuffer, 0, bufferSize, ReceiveCallback, null);

            PacketSend.WelcomeVerification(ID);
        }