Esempio n. 1
0
 public Task <bool> ConnectAsync(IPEndPoint endpoint)
 {
     EndPoint = (endpoint as HotelEndPoint);
     if (EndPoint == null)
     {
         EndPoint = new HotelEndPoint(endpoint);
     }
     return(ConnectAsync());
 }
Esempio n. 2
0
        private HNode(Socket socket, HotelEndPoint remoteEndPoint)
        {
            _socketStream = new BufferedNetworkStream(socket);

            _socket           = socket;
            _sendSemaphore    = new SemaphoreSlim(1, 1);
            _receiveSemaphore = new SemaphoreSlim(1, 1);

            socket.NoDelay     = true;
            socket.LingerState = new LingerOption(false, 0);

            SendFormat     = HFormat.EvaWire;
            ReceiveFormat  = HFormat.EvaWire;
            RemoteEndPoint = remoteEndPoint;
        }
Esempio n. 3
0
        public HNode(Socket client)
        {
            if (client == null)
            {
                throw new ArgumentNullException(nameof(client));
            }

            if (client.RemoteEndPoint != null)
            {
                EndPoint = new HotelEndPoint((IPEndPoint)client.RemoteEndPoint);
            }

            InFormat  = HFormat.EvaWire;
            OutFormat = HFormat.EvaWire;

            Client         = client;
            Client.NoDelay = true;
        }
Esempio n. 4
0
 public static Task <HNode> ConnectNewAsync(string host, int port)
 {
     return(ConnectNewAsync(HotelEndPoint.Parse(host, port)));
 }
Esempio n. 5
0
 public Task <bool> ConnectAsync(string host, int port)
 {
     return(ConnectAsync(HotelEndPoint.Parse(host, port)));
 }