Ejemplo n.º 1
0
        public async Task ConnectAsync(IPEndPoint endpoint)
        {
            EndPoint = (endpoint as HotelEndPoint);
            if (EndPoint == null)
            {
                EndPoint = new HotelEndPoint(endpoint);
            }

            IAsyncResult result = Client.BeginConnect(endpoint, null, null);
            await Task.Factory.FromAsync(result, Client.EndConnect).ConfigureAwait(false);
        }
Ejemplo n.º 2
0
 public static bool TryParse(string host, int port, out HotelEndPoint endpoint)
 {
     try
     {
         endpoint = Parse(host, port);
         return(true);
     }
     catch
     {
         endpoint = null;
         return(false);
     }
 }
Ejemplo n.º 3
0
 public Task ConnectAsync(string host, int port)
 {
     return(ConnectAsync(HotelEndPoint.Parse(host, port)));
 }
Ejemplo n.º 4
0
 public static Task <HNode> ConnectNewAsync(string host, int port)
 {
     return(ConnectNewAsync(HotelEndPoint.Parse(host, port)));
 }