www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/06/21/14:52:19

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: <Pine DOT LNX DOT 3 DOT 96 DOT 980619191419 DOT 14088A-100000 AT micro DOT internexus DOT net>
Mime-Version: 1.0
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;
          }

	<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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019