Error on Socket Connection by the Host

… constructor

public ChatClient(string Ip, int Port, string UserName, string Password ,string Channel)
{
try
{
this.UserName = UserName;
this.Channel = Channel;

            TcpClient = new TcpClient(Ip, Port);
            NetworkStream Stream = TcpClient.GetStream();
            InputStream = new StreamReader(Stream);
            OutputStream = new StreamWriter(Stream) { NewLine = "\r\n", AutoFlush = true };
            SendJoinMessage(Password);
        }
        catch (Exception e)
        {
            Console.WriteLine(e.ToString());
        }
    }

… SendJoinMessage(string Message)

private void SendJoinMessage(string Password)
{
SendIrcMessage("PASS " + Password); //
SendIrcMessage("NICK " + UserName);
SendIrcMessage(“USER " + UserName + " 8 * :” + UserName);
SendIrcMessage(“JOIN #” + Channel);
SendIrcMessage(“CAP REQ :twitch.tv/commands”);
SendIrcMessage(“CAP REQ :twitch.tv/tags”);
}

send or read is just trying to read or write use in StreamReader/Writer in asynchronous Method…

10054 socket error message seems like go wrong in first handshake or in connect moment,

but i only catch it in StreamWriter.ReadLineAsync()… at that moment.

how can i verify the connection is valid?

I already try to do in dataAvaliable or ConnectAsync…
(only i can do is maybe convert it in to use callback or delegate event)

i think many others don’t create socket connection in constructor…
(it can’t use async/await/ task)

anyway… the question is how can i verify the connection is valid?