[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: mingw32 and sockets

From: Simon Josefsson
Subject: Re: mingw32 and sockets
Date: Wed, 28 Sep 2005 11:20:26 +0200
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

Bruno Haible <address@hidden> writes:

> The way GNU clisp copes with this is a thinner layer: It accepts the facts
> that a file descriptor and a socket are different things, and that some
> initialization function is needed, and defines things like
> #ifdef _WIN32
> # define sock_errno WSAGetLastError ()
> # define sock_errno_is(val) (WSAGetLastError () == WSA##val)
> # define sock_set_errno(val) WSASetLastError (WSA##val)
>   extern int sock_read (...);
>   extern int sock_write (...);
> #else
> # define sock_errno errno
> # define sock_errno_is(val) (errno == val)
> # define sock_set_errno(val) (void)(errno = val)
> # define sock_read read
> # define sock_write write
> #endif
> This means that the program code uses slightly different conventions than
> POSIX, but still someone who knows POSIX can use this API without effort.
> Do you like that? Or better pure POSIX?

I think the above would be sufficient.  My GNU SASL tool uses the same
read/write for both sockets and stdin/stdout, so I would have to
rewrite it slightly.  But I don't need this functionality right now,
so I don't want to spend a lot of time on it.  But it was good to
raise this discussion, so I know what to implement if I get more time
to work on it or if someone sponsor me to do it.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]