home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.protocols.tcp-ip
- Path: sparky!uunet!hela.iti.org!usc!elroy.jpl.nasa.gov!dank
- From: dank@blacks.jpl.nasa.gov (Daniel R. Kegel)
- Subject: Should connect() block after setting NDELAY?
- Message-ID: <dank.720994781@blacks>
- Sender: news@elroy.jpl.nasa.gov (Usenet)
- Nntp-Posting-Host: blacks.jpl.nasa.gov
- Organization: Image Analysis Systems Group, JPL
- Date: Thu, 5 Nov 1992 20:19:41 GMT
- Lines: 26
-
-
- Hi all,
- I'm writing an application that opens sockets to many servers in parallel
- before sending out a query to each server (also in parallel). It sets
- the sockets into nonblocking mode before the connect() as follows:
- int flags;
- #ifdef USE_FIONBIO
- flags=1;
- netioctl(qp->fds, FIONBIO, (char *)&flags);
- #else
- flags = fcntl(qp->fds, F_GETFL, 0);
- #ifdef USE_O_NDELAY
- flags |= O_NDELAY;
- #else
- flags |= FNDELAY;
- #endif
- fcntl(qp->fds, F_SETFL, &flags);
- #endif
- The problem is, under SunOS 4.1.1, connect() then blocks until a
- accept, reject, or defer response comes back from the server.
- This can take several seconds if the Internet is being slow.
- The local Sun guy was able to see this in the source code, but does not
- consider it a bug. What do you all think- is it reasonable for connect()
- to block for several seconds when the socket is supposedly in nonblocking
- mode?
- - Dan Kegel (dank@blacks.jpl.nasa.gov)
-