From: michael AT weiser DOT saale-net DOT de (Michael Weiser) Subject: Re: mingw32 sock-faq examples? 21 Jun 1998 14:52:19 -0700 Message-ID: <358ebfa3.1081134.cygnus.gnu-win32@mail> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: gnu-win32 AT cygnus DOT com 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; } 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".