Subject: Re: INVALID_SOCKET symbol conflict

Re: INVALID_SOCKET symbol conflict

From: Alexander Lamaison <>
Date: Fri, 2 Mar 2012 15:43:55 +0000

On 2 March 2012 15:13, Lawson <> wrote:
> I notice that nearly all the defines in libssh2.h use the LIBSSH2_ prefix, except for INVALID_SOCKET.  It seems to be on purpose but I don't understand why.  Is it a Windows thing?

It is a Windows Winsock constant that represents the only value
returned by socket() that is guaranteed not to be a valid socket
handle. libssh2 defines it in the header for other platforms to help
with portable programming.

> My issue is that I'm writing an application (on Linux) which includes headers from multiple libraries, and some of them also set this symbol to a conflicting value.

I believe the difference is because on some platforms sockets are
signed ints and others they are unsigned ints. Can you give more
details about the conflict. Error messages etc.


Easy SFTP for Windows Explorer (
Received on 2012-03-02