/// <summary> /// Setups the listener. /// </summary> /// <param name="port">The port.</param> internal static void SetupListener(int port) { SessionManagement.Init(); _listener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); var localEp = new IPEndPoint(IPAddress.Any, port); _listener.Bind(localEp); Console.WriteLine(port); _listener.Listen(1000); _connectionReqCallback = ConnectionRequest; }
/// <summary> /// Closes this instance. /// </summary> internal void Close() { if (_closed) { return; } _closed = true; try { _sock.Close(); } catch { } SessionManagement.RemoveSession(this); }