internal static void SetupListener(int Port) { SessionManagement.Init(); DataSocket.mListener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); IPEndPoint localEP = new IPEndPoint(IPAddress.Any, Port); DataSocket.mListener.Bind(localEP); Console.WriteLine(Port); DataSocket.mListener.Listen(1000); DataSocket.mConnectionReqCallback = new AsyncCallback(DataSocket.ConnectionRequest); }
internal void Close() { if (this.mClosed) { return; } this.mClosed = true; try { this.mSock.Close(); } catch { } SessionManagement.RemoveSession(this); Logging.WriteLine("Reached end of session", ConsoleColor.Gray); }