public Task <bool> ConnectAsync(IPEndPoint endpoint) { EndPoint = (endpoint as HotelEndPoint); if (EndPoint == null) { EndPoint = new HotelEndPoint(endpoint); } return(ConnectAsync()); }
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; }
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; }
public static Task <HNode> ConnectNewAsync(string host, int port) { return(ConnectNewAsync(HotelEndPoint.Parse(host, port))); }
public Task <bool> ConnectAsync(string host, int port) { return(ConnectAsync(HotelEndPoint.Parse(host, port))); }