Esempio n. 1
0
 /// <summary>
 /// Destructor for the TCP client socket class :: Frees up the client's memory and closes the connection to the client.
 /// </summary>
 public void TcpClientClose()
 {
     // When the client disconnects unbind it's socket ID and queue the socket ID for use again with another socket.
     SocketSystem.UnbindSocket(SocketId);
     DataStream.Dispose();
     ClientHandle.Close();
 }
Esempio n. 2
0
        public int MaxClients    = 0;                                           // Maximum number of clients that can connect to the server.
        /// <summary>
        /// Destructor for the TCP Listener(Server) Socket class :: Handles freeing up any left over data in the class.
        /// </summary>
        public void TcpListenerClose()
        {
            // If the server was succesfully initiated and assigned a socket ID, free it's memory.
            // NOTE: The server has no memory created if it fails to bind to a socket.
            if (SocketId >= 0)
            {
                ServerHandle.Stop();
                Status = false;
                SocketSystem.UnbindSocket(SocketId);

                foreach (KeyValuePair <long, TcpClientSocket> ClientSocket in ClientList)
                {
                    ClientSocket.Value.ClientHandle.GetStream().Close();
                    ClientSocket.Value.ClientHandle.Close();
                    ClientSocket.Value.Connected = false;
                }
            }
        }
Esempio n. 3
0
        public IPEndPoint SenderInfo;                                           // The IP and Port Info of whomever sent data.

        /// <summary>
        /// Destructor for the UDP Server Socket class :: Unbinds the UDP socket ID and closes the socket.
        /// </summary>
        public void UdpServerClose()
        {
            SocketSystem.UnbindSocket(SocketId);
            ServerHandle.Close();
        }