|
| iMatix home page | << | < | > | >> |
SFLVersion 2.11 |
#include "sflsock.h" int sock_init (void)
Initialise the internet protocol. On most systems this is a null call. On some systems this loads dynamic libraries. Returns 0 0 if everything was okay, else returns SOCKET_ERROR. You should call sock term() when your program ends.
{
#if (defined (__WINDOWS__))
WORD
wVersionRequested; /* We really want Winsock 1.1 */
WSADATA
wsaData;
wVersionRequested = 0x0101; /* ... but we'll take 1.1 */
if (WSAStartup (wVersionRequested, &wsaData) == 0)
return (0);
else
return ((int) SOCKET_ERROR);
#elif (defined (__UTYPE_BEOS))
/* BeOS numbers sockets from 0 upwards, but this causes havoc with
* programs that expect a BSD-style numbering of 1 or higher. We
* force compatibility by creating (and wasting) one socket so that
* further socket handles are guaranteed >0.
*/
create socket ("tcp");
return (0);
#elif (defined (DOES_SOCKETS))
return (0);
#elif (defined (FAKE_SOCKETS))
return (0);
#else
connect_error_value = IP_NOSOCKETS;
return ((int) SOCKET_ERROR); /* Sockets not supported */
#endif
}
| | << | < | > | >> |
|