Exemplo n.º 1
0
        /// <summary>
        ///     Creates a new TcpCommunicationChannel object.
        /// </summary>
        /// <param name="clientSocket">
        ///     A connected Socket object that is
        ///     used to communicate over network
        /// </param>
        public TcpCommunicationChannel(Socket clientSocket)
        {
            WireProtocol = WireProtocolManager.GetWireProtocol("Binary");

            _clientSocket = clientSocket;
            // @TODO: Enable support for partial data and nagle algorithm in JsonWireProtocol
            _clientSocket.NoDelay = false;

            var ipEndPoint = (IPEndPoint)_clientSocket.RemoteEndPoint;
            _remoteEndPoint = new TcpEndPoint(ipEndPoint.Address.ToString(), ipEndPoint.Port);

            _buffer = new byte[ReceiveBufferSize];
            _syncLock = new object();
        }
Exemplo n.º 2
0
        public ZeusServerBase(string address)
        {
            // Minimal address content validation
            if (string.IsNullOrEmpty(address)) {
                throw new ArgumentNullException("address");
            }

            // Create end-point and server
            _endPoint = new TcpEndPoint(address);
            _server = ServerFactory.CreateServer(_endPoint);

            // Attach client events
            _server.ClientConnected += ServerOnClientConnected;
            _server.ClientDisconnected += ServerOnClientDisconnected;
        }
Exemplo n.º 3
0
 public TcpClient(TcpEndPoint serverEndPoint)
 {
     _serverEndPoint = serverEndPoint;
 }
Exemplo n.º 4
0
 /// <summary>
 ///     Creates a new TcpConnectionListener for given endpoint.
 /// </summary>
 /// <param name="endPoint">The endpoint address of the server to listen incoming connections</param>
 public TcpConnectionListener(TcpEndPoint endPoint)
 {
     _endPoint = endPoint;
 }
Exemplo n.º 5
0
 public TcpServer(TcpEndPoint endPoint)
 {
     _endPoint = endPoint;
 }