Mail Archives: cygwin/1998/06/21/14:52:19
Hi Laszlo,
You wrote:
>Has anyone gotten the Unix Sockets FAQ examples to compile with mingw32?
>
> http://www.ibrado.com/sock-faq/
>
>I'm using the stock egcs-mingw32 distribution from cygnus, linking the
>examples against -lwsock32 (including windows.h and windows32/sockets.h),
>but listen(), accept(), connect() etc are always failing with -1.
>gethostname() also doesnt work, though IP addresses seem ok.
On Win32 it is neccessary to initialize socket functions using
WSAStartup() and clean them up at end using WSACleanup().
WSADATA wsadata;
/* 0x0101 can be replaced with MAKEWORD(1, 1) and
** is the wanted version number of WINSOCK.DLL */
if (WSAStartup(0x0101, &wsadata) == SOCKET_ERROR)
{
printf("error initializing Windows Sockets 1.1");
return 0;
}
<socket code>
WSACleanup();
Hope that helps.
bye
Michael
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".
- Raw text -