Ejemplo n.º 1
0
        /// <summary>
        /// Destroys all resources in the connection listener.
        /// </summary>
        public void Destroy()
        {
            Stop();

            mListener = null;
            mManager = null;
            mFactory = null;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Destroys all resources in the connection listener.
        /// </summary>
        public void Destroy()
        {
            Stop();

            mListener = null;
            mManager  = null;
            mFactory  = null;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Constructs an IonTcpConnection listener and binds it to a given local IP address and TCP port.
        /// </summary>
        /// <param name="sLocalIP">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>
        public IonTcpConnectionListener(string sLocalIP, int Port, IonTcpConnectionManager pManager)
        {
            IPAddress pIP = null;
            if(!IPAddress.TryParse(sLocalIP, out pIP))
            {
                pIP = IPAddress.Loopback;
                IonEnvironment.GetLog().WriteWarning(string.Format("Connection listener was unable to parse the given local IP address '{0}', now binding listener to '{1}'.", sLocalIP, pIP.ToString()));
            }

            mListener = new TcpListener(pIP, Port);
            mConnectionRequestCallback = new AsyncCallback(ConnectionRequest);
            mFactory = new IonTcpConnectionFactory();
            mManager = pManager;

            IonEnvironment.GetLog().WriteLine(string.Format("IonTcpConnectionListener initialized and bound to {0}:{1}.", pIP.ToString(), Port.ToString()));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Constructs an IonTcpConnection listener and binds it to a given local IP address and TCP port.
        /// </summary>
        /// <param name="sLocalIP">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>
        public IonTcpConnectionListener(string sLocalIP, int Port, IonTcpConnectionManager pManager)
        {
            IPAddress pIP = null;

            if (!IPAddress.TryParse(sLocalIP, out pIP))
            {
                pIP = IPAddress.Loopback;
                IonEnvironment.GetLog().WriteWarning(string.Format("Connection listener was unable to parse the given local IP address '{0}', now binding listener to '{1}'.", sLocalIP, pIP.ToString()));
            }

            mListener = new TcpListener(pIP, Port);
            mConnectionRequestCallback = new AsyncCallback(ConnectionRequest);
            mFactory = new IonTcpConnectionFactory();
            mManager = pManager;

            IonEnvironment.GetLog().WriteLine(string.Format("IonTcpConnectionListener initialized and bound to {0}:{1}.", pIP.ToString(), Port.ToString()));
        }