Esempio n. 1
0
        public EchoServer(EndPoint endPoint, ITestOutputHelper output)
        {
            _output = output;
            _socket = new Socket(endPoint.AddressFamily(), endPoint.SocketType(), endPoint.ProtocolType());

            _socket.Bind(endPoint);
            _socket.Listen();
            _endPoint = _socket.LocalEndPoint;

            _cts = new CancellationTokenSource();
            Task.Run(async() => await Accept());
        }
Esempio n. 2
0
        public EchoClient(EndPoint endPoint)
        {
            _socket = new Socket(endPoint.AddressFamily(), endPoint.SocketType(), endPoint.ProtocolType());

            _socket.Connect(endPoint);
        }