470,641 Members | 2,453 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,641 developers. It's quick & easy.

socket connect and poll

I am not sure if this is a bug or not but it seems strange to me. If I set
the tcp socket blocking to false and do a connect, then I can catch the
socketexception. If the exception is WSAEWOULDBLOCK, then I do a poll with
timeout to see if I can connect to the remote host. When the poll returns
true, the socket Connected property is still false. Why is this?

sock.Blocking = false;
try
{
sock.connect (...)
}
catch (SocketException e)
{
if (10035 == e.ErrorCode) // WOULDBLOCK
{
bool connected = sock.Poll (10000000, Selectmode.SelectWrite);
}
}

The connected is true but the sock.Connected is still false.

Can I assume when the poll returns true, I can be sure the socket is
connected regardless of the Connected property in socket?

Thanks.
Nov 16 '05 #1
0 1536

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Joe Wong | last post: by
4 posts views Thread by faktujaa | last post: by
1 post views Thread by ETYC | last post: by
4 posts views Thread by Joe Kinsella | last post: by
3 posts views Thread by Robert A. van Ginkel | last post: by
2 posts views Thread by Droopy | last post: by
2 posts views Thread by Stressed Out Developer | last post: by
reply views Thread by jinfeng_Wang | last post: by
11 posts views Thread by atlaste | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.