So, I wrote a TCP client in VB.NET using the asynchronous functions. When I try to connect to an inactive server I get an exception in the "Connection" callback saying the connection was refused by the remote PC, which is fine.
However, I'm trying to *handle* this circumstance and having trouble. When I but a breakpoint/watch on the IAsyncResult returned by the callback, I can see an error code (see Figure 1). But that "ErrorCode" does not seem to be a member of the returned IAsyncResult object, perhaps a base class ConnectAsyncResult object? (Please see first attached figure, it explains it better).
So I try to basically "cast" the incoming object into a ConnectAsyncResult and I get an error "not accessible because it is 'Friend'. SURELY there is a way to get at this error info, if I can watch it, I just can't seem to get the syntax right.
Thanks for any help.