Ejemplo n.º 1
0
        public DthTestClient(DthTestServer server, int contextId)
        {
            var socket = new Socket(AddressFamily.InterNetwork,
                                    SocketType.Stream,
                                    ProtocolType.Tcp);

            socket.Connect(new IPEndPoint(IPAddress.Loopback, server.Port));

            _hostId    = server.HostId;
            _contextId = contextId;

            _networkStream = new NetworkStream(socket);
            _reader        = new BinaryReader(_networkStream);
            _writer        = new BinaryWriter(_networkStream);
        }
Ejemplo n.º 2
0
        public DthTestClient(DthTestServer server)
        {
            var socket = new Socket(AddressFamily.InterNetwork,
                                    SocketType.Stream,
                                    ProtocolType.Tcp);

            socket.Connect(new IPEndPoint(IPAddress.Loopback, server.Port));

            _hostId = server.HostId;

            _networkStream = new NetworkStream(socket);
            _reader = new BinaryReader(_networkStream);
            _writer = new BinaryWriter(_networkStream);

            _messageQueue = new BlockingCollection<DthMessage>();

            _readCancellationToken = new CancellationTokenSource();
            Task.Run(() => ReadMessage(_readCancellationToken.Token), _readCancellationToken.Token);
        }
Ejemplo n.º 3
0
        public DthTestClient(DthTestServer server)
        {
            var socket = new Socket(AddressFamily.InterNetwork,
                                    SocketType.Stream,
                                    ProtocolType.Tcp);

            socket.Connect(new IPEndPoint(IPAddress.Loopback, server.Port));

            _hostId = server.HostId;

            _networkStream = new NetworkStream(socket);
            _reader        = new BinaryReader(_networkStream);
            _writer        = new BinaryWriter(_networkStream);

            _messageQueue = new BlockingCollection <DthMessage>();

            _readCancellationToken = new CancellationTokenSource();
            Task.Run(() => ReadMessage(_readCancellationToken.Token), _readCancellationToken.Token);
        }