/// <summary>
        /// Constructs an instance of IonTcpConnectionManager, constructs an IonTcpConnectionListener, binds it to a given local IP and TCP port and sets the maximum amount of connections.
        /// </summary>
        /// <param name="sLocalIP">The local IP address to bind the listener to.</param>
        /// <param name="Port">The TCP port number to bind the listener to.</param>
        /// <param name="maxSimultaneousConnections">The maximum amount of connections in the connection manager.</param>
        public IonTcpConnectionManager(string sLocalIP, int Port, int maxSimultaneousConnections)
        {
            int initialCapacity = maxSimultaneousConnections;
            if (maxSimultaneousConnections > 4)
                initialCapacity /= 4; // Set 1/4 of max connections as initial capacity to avoid too much resizing

            mConnections = new Dictionary<uint, IonTcpConnection>(initialCapacity);
            mMaxSimultaneousConnections = maxSimultaneousConnections;

            mListener = new IonTcpConnectionListener(sLocalIP, Port, this);
        }
示例#2
0
        /// <summary>
        /// Constructs an instance of IonTcpConnectionManager, constructs an IonTcpConnectionListener, binds it to a given local IP and TCP port and sets the maximum amount of connections.
        /// </summary>
        /// <param name="sLocalIP">The local IP address to bind the listener to.</param>
        /// <param name="Port">The TCP port number to bind the listener to.</param>
        /// <param name="maxSimultaneousConnections">The maximum amount of connections in the connection manager.</param>
        public IonTcpConnectionManager(string sLocalIP, int Port, int maxSimultaneousConnections)
        {
            int initialCapacity = maxSimultaneousConnections;

            if (maxSimultaneousConnections > 4)
            {
                initialCapacity /= 4; // Set 1/4 of max connections as initial capacity to avoid too much resizing
            }
            mConnections = new Dictionary <uint, IonTcpConnection>(initialCapacity);
            mMaxSimultaneousConnections = maxSimultaneousConnections;

            mListener = new IonTcpConnectionListener(sLocalIP, Port, this);
        }
示例#3
0
 /// <summary>
 /// Destroys all resources in the connection manager.
 /// </summary>
 public void DestroyManager()
 {
     mConnections.Clear();
     mConnections = null;
     mListener    = null;
 }
 /// <summary>
 /// Destroys all resources in the connection manager.
 /// </summary>
 public void DestroyManager()
 {
     mConnections.Clear();
     mConnections = null;
     mListener = null;
 }