/// <summary> /// Destroys all resources in the connection listener. /// </summary> public void Destroy() { Stop(); mListener = null; mManager = null; mFactory = null; }
/// <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())); }
/// <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())); }