protected override async void ConnectAsync(string hostAddress, ushort port)
{
Host = hostAddress;
try
{
serverHost = new HostName(hostAddress);
await socket.ConnectAsync(serverHost, port.ToString());
Connected = true;
OnConnected();
ReadAsync();
}
catch (Exception e)
{
// If this is an unknown status,
// it means that the error is fatal and retry will likely fail.
if (SocketError.GetStatus(e.HResult) == SocketErrorStatus.Unknown)
throw;
ErrorDisconnect(e.Message);
}
}