By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,312 Members | 1,248 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,312 IT Pros & Developers. It's quick & easy.

socket connect and poll

P: n/a
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
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.