Пример #1
0
        /// <summary>
        ///   Destroys all resources in the Connection listener.
        /// </summary>
        public void Destroy()
        {
            Stop();

            _listener = null;
            _manager  = null;
            _factory  = null;
        }
Пример #2
0
        /// <summary>
        ///   Constructs an IonTcpConnection listener and binds it to a given local IP address and TCP port.
        /// </summary>
        /// <param name = "localIP">The IP address string to parse and bind the listener to.</param>
        /// <param name = "port">The TCP port number to parse the listener to.</param>
        /// <param name = "manager">TODO: Document</param>
        public IonTcpConnectionListener(string localIP, int port, IonTcpConnectionManager manager)
        {
            IPAddress ip;
            if (!IPAddress.TryParse(localIP, out ip))
            {
                ip = IPAddress.Loopback;
                CoreManager.ServerCore.GetStandardOut().PrintWarning(
                    string.Format(
                        "Connection listener was unable to parse the given local IP address '{0}', now binding listener to '{1}'.",
                        localIP, ip));
            }

            _listener = new TcpListener(ip, port);
            _connectionRequestCallback = new AsyncCallback(ConnectionRequest);
            _factory = new IonTcpConnectionFactory();
            _manager = manager;

            CoreManager.ServerCore.GetStandardOut().PrintNotice(
                string.Format("IonTcpConnectionListener initialized and bound to {0}:{1}.", ip,
                              port));
        }
Пример #3
0
        /// <summary>
        ///   Constructs an IonTcpConnection listener and binds it to a given local IP address and TCP port.
        /// </summary>
        /// <param name = "localIP">The IP address string to parse and bind the listener to.</param>
        /// <param name = "port">The TCP port number to parse the listener to.</param>
        /// <param name = "manager">TODO: Document</param>
        public IonTcpConnectionListener(string localIP, int port, IonTcpConnectionManager manager)
        {
            IPAddress ip;

            if (!IPAddress.TryParse(localIP, out ip))
            {
                ip = IPAddress.Loopback;
                CoreManager.ServerCore.GetStandardOut().PrintWarning(
                    string.Format(
                        "Connection listener was unable to parse the given local IP address '{0}', now binding listener to '{1}'.",
                        localIP, ip));
            }

            _listener = new TcpListener(ip, port);
            _connectionRequestCallback = new AsyncCallback(ConnectionRequest);
            _factory = new IonTcpConnectionFactory();
            _manager = manager;

            CoreManager.ServerCore.GetStandardOut().PrintNotice(
                string.Format("IonTcpConnectionListener initialized and bound to {0}:{1}.", ip,
                              port));
        }
Пример #4
0
        /// <summary>
        ///   Destroys all resources in the Connection listener.
        /// </summary>
        public void Destroy()
        {
            Stop();

            _listener = null;
            _manager = null;
            _factory = null;
        }