From: Rob McCool <robm@netscape.com>
Newsgroups: netscape.devs-nsapi
Subject: Re: Type of sn->csd
Date: Fri, 26 Jul 1996 17:53:07 -0700

George Feinberg wrote: > I am writing a platform-independent piece of code that wants to write > to the output channel in a session. It does effectively what a > net_write() to sn->csd would do, but I don't want to call net_write(), > since the code does not want to know that it's running as an NSAPI > program. The problem is that, on Windows NT (3.51, intel), when I do > a WriteFile() call on the sn->csd, it fails (a nasty exception inside > the system). The value of sn->csd is 952, which leads me to believe > that it's a HANDLE. It's typedef'd to be a SOCKET, as near as I can > tell in the NSAPI headers, and I think that SOCKET types can be > treated as HANDLEs (not FDs). > > So, what I'm asking is, why doesn't WriteFile() work? By the way, > this all works just fine on Solaris.

sn->csd is a SOCKET, or an unsigned int. The NT winsock doesn't necessarily allocate the low sections of the file descriptor space first like UNIX does.

WriteFile is not the call you want, as far as I know it only works on filesystem files. What you want is send(), which should behave like net_write() so long as SSL is not active.

--
Rob McCool, robm@netscape.com http://home.netscape.com/people/robm/
Stunt Programmer, Netscape Communications Corporation
It was working ten minutes ago, I swear...
Reproduced by permission of the author.