Networking Forums

Networking Forums > Computer Networking > Linux Networking > Non-blocking connect using getsockopt

Reply
Thread Tools Display Modes

Non-blocking connect using getsockopt

 
 
sucheta.phatak@gmail.com
Guest
Posts: n/a

 
      08-04-2006, 01:12 PM
Hi All,

I am trying to use non blocking connect method for connecting to a
range of hosts. Now I am observing a strange behavior on Linux
(Linux.2.4.9).
Algorithm:
I am trying to connect to an array of sockets using a separate connect
call for each of them.

for( some range of socket fds)
connect(); //all these sockets are non blocking.
this connect returns immediately. Now if there is no error, I assign
this socket FD to a socket fd set, which is eventually used by select.


Then I call select () passing this socket fd set. While doing this I
make sure that numbers of FDS in my set are < FD_SETSIZE.
After I come out of the select call, I check for return value and if
its > 0 then I call getsockopt on each of the socket fds in the set(
which pass FD_ISSET ).
If getsockopt ( with SOL_SOCKET and SO_ERROR) return error then I
assume Connect failed.

Now the problem is: On Linux 2.4.9
If the range of FDs I am polling on is big, then for some correct
hosts(which are reachable and have port open) getsockopt returns error
113 (EHOSTUNREACH).
On the other hand for small range of FDs for the same host getsockopt
succeeds.

Why is this anomalous behavior observed? Is there a different and
correct way available?

Waiting for reply.
Sucheta.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Internet Blocking KenP Broadband Hardware 2 04-23-2008 11:55 PM
Blocking IM gerald Windows Networking 3 02-07-2006 05:32 PM
What is difference of SYNC, ASYNC, BLOCKING, NON-BLOCKING sockets? kevin Linux Networking 0 11-21-2005 09:56 AM
Blocking P2P Mike Linux Networking 2 05-22-2004 12:59 PM
set/getsockopt() And Promiscuous Mode Josh Birnbaum Linux Networking 2 11-01-2003 05:44 PM



1 2 3 4 5 6 7 8 9 10 11