/// <summary>
 /// Instantiates an instance of the TcpClientHandler class with the specified SocketBinder and parent TcpServerHandler.
 /// </summary>
 /// <param name="binder">SocketBinder to bind the client's new socket too.</param>
 /// <param name="server">TcpServerHandler this client connection belongs too.</param>
 public TcpClientHandler(SocketBinder binder, TcpServerHandler server, uint timeout) : base(binder)
 {
     Server   = server;
     Timeout  = timeout;
     Receiver = null;
     Stream   = null;
 }
 /// <summary>
 /// Instantiates an instance of the TcpClientHandler class with the specified SocketBinder and parent TcpServerHandler.
 /// </summary>
 /// <param name="binder">SocketBinder to bind the client's new socket too.</param>
 /// <param name="server">TcpServerHandler this client connection belongs too.</param>
 public TcpClientConnectionHandler( SocketBinder binder, uint timeout, IPAddress ip, int port )
     : base(binder)
 {
     Timeout = timeout;
     Stream = null;
     BeginSetup(port, ip);
 }
 /// <summary>
 /// Instantiates an instance of the TcpClientHandler class with the specified SocketBinder and parent TcpServerHandler.
 /// </summary>
 /// <param name="binder">SocketBinder to bind the client's new socket too.</param>
 /// <param name="server">TcpServerHandler this client connection belongs too.</param>
 public TcpClientHandler( SocketBinder binder, TcpServerHandler server, uint timeout )
     : base(binder)
 {
     Server = server;
     Timeout = timeout;
     Receiver = null;
     Stream = null;
 }
示例#4
0
        /// <summary>
        /// Instantiates an instances of the UdpServerHandler class using the specified SocketBinder and parameters.
        /// </summary>
        /// <param name="binder">SocketBinder to bind a new socket too.</param>
        /// <param name="port">Port used for receiving.</param>
        /// <param name="alignment">Default alignment in bytes for buffers.</param>
        /// <param name="packetHeader">Collection of bytes used for packet verification.</param>
        public UdpServerHandler(SocketBinder binder, int port, int alignment) : base(binder)
        {
            Port      = port;
            Alignment = (alignment > 0) ? alignment : 1;
            running   = false;

            Listener = new UdpClient(port);
            Listener.EnableBroadcast = true;
            Listener.AllowNatTraversal(true);
        }
        /// <summary>
        /// Instantiates an instances of the UdpServerHandler class using the specified SocketBinder and parameters.
        /// </summary>
        /// <param name="binder">SocketBinder to bind a new socket too.</param>
        /// <param name="port">Port used for receiving.</param>
        /// <param name="alignment">Default alignment in bytes for buffers.</param>
        /// <param name="packetHeader">Collection of bytes used for packet verification.</param>
        public UdpServerHandler( SocketBinder binder, int port, int alignment )
            : base(binder)
        {
            Port = port;
            Alignment = ( alignment > 0 ) ? alignment : 1;
            running = false;

            Listener = new UdpClient( port );
            Listener.EnableBroadcast = true;
            Listener.AllowNatTraversal( true );
        }
        /// <summary>
        /// Instantiates an instance of the TcpServerHandler class with the specified SocketBinder and setup parameters.
        /// </summary>
        /// <param name="binder">SocketBinder to bind a new socket too.</param>
        /// <param name="port">Port to receive client connections and packets on.</param>
        /// <param name="maxConnections">Maximum number of allowed client connections. Set to <= 0 for uncapped.</param>
        /// <param name="alignment">Default alignment for receive buffers.</param>
        /// <param name="packetHeader">Collection of bytes used for packet verification.</param>
        /// <param name="ip">IP address to listen on--or NULL to listen on all available IP addresses on this device.</param>
        public TcpServerHandler( SocketBinder binder, int port, int maxConnections, int alignment, uint clientTimeout, IPAddress ip = null )
            : base(binder)
        {
            if ( maxConnections > 0 ) {
                MaxConnections = maxConnections;
                ClientMap = new Dictionary<int,TcpClientHandler>( maxConnections );
            } else {
                MaxConnections = -1;
                ClientMap = new Dictionary<int,TcpClientHandler>();
            }

            Port = port;
            Alignment = alignment;
            ClientTimeout = clientTimeout;

            BeginSetup( port, ip );
        }
示例#7
0
        /// <summary>
        /// Instantiates an instance of the TcpServerHandler class with the specified SocketBinder and setup parameters.
        /// </summary>
        /// <param name="binder">SocketBinder to bind a new socket too.</param>
        /// <param name="port">Port to receive client connections and packets on.</param>
        /// <param name="maxConnections">Maximum number of allowed client connections. Set to <= 0 for uncapped.</param>
        /// <param name="alignment">Default alignment for receive buffers.</param>
        /// <param name="packetHeader">Collection of bytes used for packet verification.</param>
        /// <param name="ip">IP address to listen on--or NULL to listen on all available IP addresses on this device.</param>
        public TcpServerHandler(SocketBinder binder, int port, int maxConnections, int alignment, uint clientTimeout, IPAddress ip = null) : base(binder)
        {
            if (maxConnections > 0)
            {
                MaxConnections = maxConnections;
                ClientMap      = new Dictionary <int, TcpClientHandler>(maxConnections);
            }
            else
            {
                MaxConnections = -1;
                ClientMap      = new Dictionary <int, TcpClientHandler>();
            }

            Port          = port;
            Alignment     = alignment;
            ClientTimeout = clientTimeout;

            BeginSetup(port, ip);
        }
 /// <summary>
 /// Instantiates an instance of the TcpClientHandler class with the specified SocketBinder and parent TcpServerHandler.
 /// </summary>
 /// <param name="binder">SocketBinder to bind the client's new socket too.</param>
 /// <param name="server">TcpServerHandler this client connection belongs too.</param>
 public TcpClientConnectionHandler(SocketBinder binder, uint timeout, IPAddress ip, int port) : base(binder)
 {
     Timeout = timeout;
     Stream  = null;
     BeginSetup(port, ip);
 }