home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.protocols.tcp-ip.ibmpc:4961 comp.sys.mac.programmer:14768
- Path: sparky!uunet!dtix!darwin.sura.net!wupost!usc!sdd.hp.com!elroy.jpl.nasa.gov!dank
- From: dank@blacks.jpl.nasa.gov (Daniel R. Kegel)
- Newsgroups: comp.protocols.tcp-ip.ibmpc,comp.sys.mac.programmer
- Subject: tcp-ip library nonblocking I/O (Berkeley compatible)?
- Message-ID: <dank.715232338@blacks>
- Date: 31 Aug 92 03:38:58 GMT
- References: <1992Aug24.125112.14506@info.ucl.ac.be> <BtJy7I.HBL@watserv1.uwaterloo.ca>
- Sender: news@elroy.jpl.nasa.gov (Usenet)
- Organization: Image Analysis Systems Group, JPL
- Lines: 39
- Nntp-Posting-Host: blacks.jpl.nasa.gov
-
- eengelke@sail.uwaterloo.ca (Erick Engelke) writes:
- >I hate to tell you this, but even the nicest BSD emulation libraries
- >lack a lot of the BSD feel...
- >Novell LWP includes a nice BSD 4.2 Windows emulation library. FTP is just
- >offerring a new release, so I expect they added Windows support, ask
- >at info@ftp.com. B&W's otherwise attractive product is lacking BSD 4.2
- >emulation in either DOS or Windows...
-
- Perhaps Erick or another TCP/IP guru can answer some related questions.
- I want to port to the Mac and to MS-DOS (not neccesarily Windows) a Unix
- program which initiates several connections to TCP servers and uses
- nonblocking I/O to manage all the connections simultaneously.
-
- Questions:
- 1) Can select() or poll() be used with tcp/ip sockets to detect which of a
- set of sockets is ready for I/O?
-
- 2) Can one use non-blocking I/O on a socket? If so, how?
- In UNIX, one does the following:
-
- fd = socket(hp->h_addrtype, SOCK_STREAM, 0);
- /* Use non-blocking I/O on this socket */
- #if USE_FIONBIO /* some unix systems use ioctl to set nonblocking...*/
- ioctl(fd, FIONBIO, (char *)&state);
- #else /* others use fcntl() */
- flags = fcntl(fd, F_GETFL, 0);
- flags |= FNDELAY;
- fcntl(fd, F_SETFL, &flags);
- #endif
- /* Start connecting to the host. May get EINPROGRESS. */
- err = connect(fd, (struct sockaddr *)&sin, sizeof(sin));
-
- Will this work in any of the popular IBM-PC tcp/ip packages?
- (FYI, the answer for TGV's Multinet under VMS is a qualified yes.
- I'd also like to know the answer for MacTCP.)
-
- I'll summarize any answers.
- Thanks,
- Dan Kegel (dank@blacks.jpl.nasa.gov)
-