Exemplo n.º 1
0
            /// <summary>
            /// Initializes a new instance of the <see cref="RemoteClient" /> class.
            /// </summary>
            /// <param name="server">The value for the <see cref="RemoteClient.Server" /> property.</param>
            /// <param name="client">The value for the <see cref="RemoteClient.Client" /> property.</param>
            /// <exception cref="ArgumentNullException">
            /// At least one argument is <see langword="null" />.
            /// </exception>
            public RemoteClient(Server server, TcpClient client)
            {
                if (server == null)
                {
                    throw new ArgumentNullException("server");
                }

                if (client == null)
                {
                    throw new ArgumentNullException("client");
                }

                this.Client = client;
                this.Server = server;

                this.Address = (IPEndPoint)client.Client.RemoteEndPoint;
            }
            /// <summary>
            /// Initializes a new instance of the <see cref="TcpClientConnectionHandler" /> class.
            /// </summary>
            /// <param name="server">The underlying server.</param>
            /// <param name="client">The underlying client.</param>
            /// <exception cref="ArgumentNullException">
            /// At least one argument is <see langword="null" />.
            /// </exception>
            public TcpClientConnectionHandler(Server server, RemoteClient client)
            {
                if (server == null)
                {
                    throw new ArgumentNullException("server");
                }

                if (client == null)
                {
                    throw new ArgumentNullException("client");
                }

                this._STREAM = new NetworkStream(client.Client.Client, true);

                this._REMOTE_CLIENT = client;
                this._SERVER = server;

                this.CloseConnection = true;
            }