delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/12/02/07:34:07

From: sharpd AT mindspring DOT com (Donald Sharp)
Subject: Re: [B20] porting code from Unix to Windows NT
2 Dec 1998 07:34:07 -0800 :
Message-ID: <3.0.6.32.19981201133628.00907100.cygnus.gnu-win32@mindspring.com>
References: <199812010458 DOT PAA24037 AT mali DOT comdyn DOT com DOT au>
Mime-Version: 1.0
To: raf AT comdyn DOT com DOT au (raf), gnu-win32 AT cygnus DOT com

At 03:58 PM 12/1/98 +1100, raf wrote:
>Christine Pourcelot wrote:
>
>>I'm trying to port some Unix code to Windows Nt with Cygwin tools. My
>>problem is that code handles sockets and I can't compile the source.
>>I've put #define Win32_winsock and #include 'windows.h' in my source.
>>But in my Unix code (somebody else wrote it, not me... I'm novice with
>>unix ans C programming) SOCKET is defined like this :
>
>>typedef struct sockaddr_un SOCKET;
>
>>sockaddr_un is defined in sys/un.h like this :
>>/*
>> * definitions for Unix IPC domain.
>>*/
>>#if defined(_SOCKADDR_LEN) || defined(_KERNEL) ||
>>defined(_XOPEN_SOURCE_EXTENDED)
>>struct sockaddr_un {
>>    unsigned char sun_len;
>>    sa_family_t     sun_family;
>>    char sun_path[104];
>>};
>>#else
>>struct sockaddr_un {
>>    unsigned short  sun_familly;
>>    char sun_path[104];
>>}
>>#endif
>
>>my unix code uses sun_path and sun_family...
>
>>in Sockets.h (cygwin), SOCKETis defined as an unsigned int
>
>these are not your average socket.
>they are unix domain sockets which
>are not yet implemented in cygwin.
>
>you could either change your code
>to use NT's named pipes instead,
>or implement unix domain sockets
>in cygwin, using NT's named pipes.
>
>raf
>

this isn't quite correct.  If you look carefully he is running
into the problem where some past programmer of the code he is
now working on, typedef'ed the struct sockaddr_un to be SOCKET
which in the windows world is the socket descriptor returned from
a socket() call.  He also needs to change his code over to use
named pipes/unix domain sockets.

donald

-
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