Is it possible to somehow use the winsock API on a unix machine?

Ok, so if on my unix box I see a call to:

#if INCL_WINSOCK_API_PROTOTYPES
WINSOCK_API_LINKAGE
int
WSAAPI
connect(
    IN SOCKET s,
    __in_bcount(namelen) const struct sockaddr FAR * name,
    IN int namelen
    );
#endif /* INCL_WINSOCK_API_PROTOTYPES */

Does that mean something's not right?

>>Does that mean something's not right?
No, it means the code has been ported to both MS-Windows and *nix. If compiling on MS-Windows then define INCL_WINSOCK_API_PROTOTYPES somewhere before the code snippet you posted. Using preprocessor instructions like that is a common way to write portable programs that are compiled with different compilers and/or operating systems.

Use of the FAR macro would leave me to believe the code was written for some 16-bit segmented MS-DOS compiler. 32-bit compilers do not use FAR.

Edited 5 Years Ago by Ancient Dragon: n/a

This article has been dead for over six months. Start a new discussion instead.