コード例 #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();
        }
コード例 #2
0
ファイル: ZeusServerBase.cs プロジェクト: GodLesZ/ZeusEngine
        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;
        }
コード例 #3
0
ファイル: TcpClient.cs プロジェクト: GodLesZ/ZeusEngine
 public TcpClient(TcpEndPoint serverEndPoint)
 {
     _serverEndPoint = serverEndPoint;
 }
コード例 #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;
 }
コード例 #5
0
ファイル: TcpServer.cs プロジェクト: GodLesZ/ZeusEngine
 public TcpServer(TcpEndPoint endPoint)
 {
     _endPoint = endPoint;
 }