Delphi / Winsock / CGI problems, HELP please!

G'Day All,

I'm trying to write a CGI program that will send off some email
(as well as do some other things).  I've been able to write a unit
for sending email (calling borland's winsock.dcu) and the program
that tests that unit works fine (tested in Win95 & WinNT), but when
I call the unit from a formless Delphi app the winsock calls fail.

Specifically: the first call (after the initialisation) is:

    SocketNum := socket(PF_INET, SOCK_STREAM, IPPROTO_IP);

the return equals   INVALID_SOCKET

A call to WSAGetLastError reports error 10041, which is "WSAEPROTOTYPE",
whatever that means (if anyone knows please let me know!!!).

Calling WSAGetLastError before the call to 'socket' returns 0
so everything seems to be fine before (the winsock initialisation seems OK).

The strange thing is that when I call the unit from an "ordinary" program
it works fine.  Can the fact that the progam is formless be effecting things?

If anyone can make any suggestions I'd really appreciate it!
Post here or email.

Thanks
S.

 _--_|\     Stephen Peter                             School of Architecture
/      \    S.Pe...@unsw.EDU.AU                University of New South Wales
\_.--._/<-------------------------------------------------------------------
      v             http://www.arch.unsw.edu.au/staff/arch/peter/stephen.htm