home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / protocol / tcpip / 5059 < prev    next >
Encoding:
Text File  |  1992-11-05  |  1.3 KB  |  38 lines

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