Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Unsubscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com Message-Id: <199908190406.XAA04021@mercury.xraylith.wisc.edu> To: Bob Crispen cc: cygwin AT sourceware DOT cygnus DOT com Subject: Re: fdopen() and winsock In-Reply-To: Your message of "Wed, 18 Aug 1999 22:32:48 CDT." <37BB7AE0 DOT 8A7D1E98 AT hiwaay DOT net> Date: Wed, 18 Aug 1999 23:06:48 -0500 From: Mumit Khan Bob Crispen writes: > This has come up several times in the archives, but the only > reply I've seen so far is "you can't do that" so I thought > I'd try again, just in case. > > When I compile with Cygwin 2.95 and don't set the -mno-cygwin > flag, then the following works just fine: > > /* > * Convert the socket to a stream > */ > if (0 > (sf = fdopen(s, "r+"))) { > fprintf(stderr, "fdopen failed: %s\n", strerror(errno)); > close(s); > exit (EXIT_FAILURE); > } > Ah, as far as I know, one of the big limitations of winsock is that the SOCKET type is *not* equivalent to file descriptor unlike that using BSD or POSIX sockets. That's one of the major reasons for using a separate data type, SOCKET, as opposed to int, typical type of a file descriptor. This implies that you cannot mix SOCKETs and stdio, sorry. This is the case when you use -mno-cygwin. Cygwin of course implements POSIX sockets and there is no problem there. Case without -mno-cygwin. Regards, Mumit -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com