socket woes
I have been getting lots of socket-related errors
for a long time (months/years). Here is one example
of one message:
HHCLG009S Syslog message pipe creation failed: The requested address is not valid in its context.
I don't know the last thing about sockets, but I
decided to start putting some debug info in after
a particularly persistent spate of errors (normally
I just need to rerun it a couple of times and it
goes away).
I did a search to find out about the socketpair
function, and after a lot of stuffing around with
combinations, I decided the problem was sort of
elsewhere. Anyway, I haven't had an error since
this change went in, despite running it 10 times
or something, but since it's a random (ie presumably
time sensitive) error anyway, who knows.
BFN. Paul.
Index: hercules/hmacros.h
diff -c hercules/hmacros.h:1.6 hercules/hmacros.h:1.7
*** hercules/hmacros.h:1.6 Sun Jan 11 13:02:43 2009
--- hercules/hmacros.h Sat Jun 27 17:58:38 2009
***************
*** 78,84 ****
#endif
#ifdef _MSVC_
! #define create_pipe(a) socketpair(AF_INET,IPPROTO_IP,SOCK_STREAM,a)
#define read_pipe(f,b,n) recv(f,b,n,0)
#define write_pipe(f,b,n) send(f,b,(int)n,0)
#define close_pipe(f) closesocket(f)
--- 78,84 ----
#endif
#ifdef _MSVC_
! #define create_pipe(a) socketpair(AF_INET,SOCK_STREAM,IPPROTO_IP,a)
#define read_pipe(f,b,n) recv(f,b,n,0)
#define write_pipe(f,b,n) send(f,b,(int)n,0)
#define close_pipe(f) closesocket(f)
Index: hercules/w32util.c
diff -c hercules/w32util.c:1.1.1.2 hercules/w32util.c:1.2
*** hercules/w32util.c:1.1.1.2 Sun Jan 11 12:52:04 2009
--- hercules/w32util.c Sat Jun 27 17:58:38 2009
***************
*** 1864,1871 ****
// -1 shall be returned and errno set to indicate the error."
if ( AF_INET != domain ) { errno = WSAEAFNOSUPPORT; return -1; }
! if ( SOCK_STREAM != protocol ) { errno = WSAEPROTONOSUPPORT; return -1; }
! if ( IPPROTO_IP != type ) { errno = WSAEPROTOTYPE; return -1; }
socket_vector[0] = socket_vector[1] = INVALID_SOCKET;
--- 1864,1871 ----
// -1 shall be returned and errno set to indicate the error."
if ( AF_INET != domain ) { errno = WSAEAFNOSUPPORT; return -1; }
! if ( IPPROTO_IP != protocol ) { errno = WSAEPROTONOSUPPORT; return -1; }
! if ( SOCK_STREAM != type ) { errno = WSAEPROTOTYPE; return -1; }
socket_vector[0] = socket_vector[1] = INVALID_SOCKET;