WinRt StreamSocket.ConnectAsync Exception

257 views Asked by At

I'm writing a WIntRt application in C# and I use StreamSocket.

The fragment of code I have problem with looks like this

try
{
await StreamerConnection.socket.ConnectAsync(new Host("192.168.10.14", "8777");
}
catch(Exception ex)
{
ex.ToString();
}

My problem is that when remote host is inaccessible, my program instead entering the catch block, exists from function in which the try..catch block is. How can I handle situation when remote host is inaccessible and StreamSocket cannot connect to that host? How can I determine that it could not connect because destination host was unreachable?

0

There are 0 answers