I have a program that is failing on the above call. This program
works in house on V52 machine. On a client's box, it is not. This is
a snippet from that actual piece of code. The program is set up to
use port 8100. There are no port restrictions set up on the client
machine. This was compiled for V4R4. If there were an actual problem
with the descriptor then I would expect one of the first two calls to
fail. My gut tells me this is an OS release problem, BUT, all of
these calls come from system service programs so nothing is statically
bound AND I cannot see any change to the APIs themselves.

Anybody got a guess?


void *ServerTask(void *parm)
{
Server_parm_t *p = (Server_parm_t *)parm;
pthread_t servlets[Number_Of_Servlets];
struct sockaddr_in serveraddr;
size_t local_addr_length, remote_addr_length, len;
int i, listen_sd, new_sock = -1, rc, flag = 1, port, pid;
char recvbuf[2000], ra_str[20], la_str[20], tempstr[6];
void *status;


pid = pthread_getthreadid_np().intId.lo;

/*
Code to make a TCP socket connection.
*/
if ((listen_sd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
log_message("QSYSOPR", "%s: LINE %d: socket() failed: %s",
Module, __LINE__, strerror(errno));
exit(-1);
}

if ((rc = setsockopt(listen_sd, SOL_SOCKET, SO_REUSEADDR, (char
*)&flag, sizeof(flag))) < 0) {
log_message("QSYSOPR", "%s: LINE %d: setsockopt() failed: %s",
Module, __LINE__, strerror(errno));
close(listen_sd);
exit(-1);
}

/*
The conversion from packed decimal to integer should happen
without a cast operator.
*/
sprintf(tempstr, "%5s", configuration.GFPRTp);
port = atoi(tempstr);

/*
Setup connection parameters to bind to our socket.
*/
memset(&serveraddr, 0, sizeof(struct sockaddr_in));
serveraddr.sin_family = AF_INET;
serveraddr.sin_port = htons(port);
serveraddr.sin_addr.s_addr = htonl(INADDR_ANY);

/*
Bind the address to the socket...
*/
if (bind(listen_sd, (struct sockaddr *)&serveraddr,
sizeof(serveraddr)) < 0) {
log_message("QSYSOPR", "%s: LINE %d: bind() failed: %s",
Module, __LINE__, strerror(errno));
close(listen_sd);
exit(-1);
}