Beispiel #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);
        }
Beispiel #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);
     }
 }
Beispiel #3
0
 public Task ConnectAsync(string host, int port)
 {
     return(ConnectAsync(HotelEndPoint.Parse(host, port)));
 }
Beispiel #4
0
 public static Task <HNode> ConnectNewAsync(string host, int port)
 {
     return(ConnectNewAsync(HotelEndPoint.Parse(host, port)));
 }