8 #if !defined (_WIN32) || defined (__CYGWIN__)
12 #if defined (__SVR4) && defined (__sun)
13 #include <sys/filio.h>
24 #if defined (_WIN32) && !defined (__CYGWIN__)
25 return ::closesocket( fd );
34 #if defined (_WIN32) && !defined (__CYGWIN__)
35 inp->s_addr = ::inet_addr( host );
36 if (inp->s_addr == INADDR_NONE)
return 0;
46 int ret =
::socket( domain, type, protocol );
47 #if defined (_WIN32) && !defined (__CYGWIN__)
48 if (ret == INVALID_SOCKET)
return -1;
50 if (ret < 0)
return -1;
55 INLINE int recv(
int fd,
void *buf,
unsigned int len,
int flags )
57 #if defined (_WIN32) && !defined (__CYGWIN__)
58 int ret =
::recv( fd, (
char*) buf, len, flags );
60 int ret =
::recv( fd, buf, len, flags );
77 #if !defined (_WIN32) || defined (__CYGWIN__)
78 int datato = isBlocking ? 0 : 1;
79 if (::ioctl( _fd, FIONBIO, &datato ) == -1) {
80 #if defined (_WIN32) || __GNUC__ != 2
81 ::perror(
"Error fcntl : " );
83 fprintf( stderr,
"Error fcntl : " );
88 unsigned long datato = isBlocking ? 0 : 1;
89 if (::ioctlsocket( _fd, FIONBIO, &datato ) != 0) {
90 #if defined (_WIN32) || __GNUC__ != 2
91 ::perror(
"Error fcntl : " );
93 fprintf( stderr,
"Error fcntl : " );