The following code has been running for several years without problems on 32 bit systems. We are now attempting to build the code for a 64 bit Windows 7 system. The select statement is returning a 10038 error. The socket was ok in the "bind" and "listen" function calls. Perhaps the structure being built by FD_SET is aligned improperly? Any ideas?

int rc = 0, temprc = 0;
SOCKET AcceptSocket = 0, objListenSocket = 0;
struct sockaddr_in socketinfo, acceptinfo;
int iLength;
struct timeval stTimeout;
fd_set structReadFDS;
char cLogBuffer[150];


// Create the listening socket
objListenSocket = socket (AF_INET, SOCK_STREAM, 0);
if (objListenSocket == INVALID_SOCKET)
{
rc = XSRV_COULDNT_CREATE_SOCKET;
temprc = WSAGetLastError();
goto exit1;
}



// Bind the socket
// Port number must be in Network byte order (big endian)
memset (&socketinfo, '\0', sizeof(socketinfo));
socketinfo.sin_family = AF_INET;
socketinfo.sin_port = htons(47809);
socketinfo.sin_addr.s_addr = INADDR_ANY;
rc = bind(objListenSocket, (struct sockaddr *)&socketinfo, sizeof(socketinfo));
if (rc == SOCKET_ERROR)
{
temprc = WSAGetLastError();
rc = XSRV_COULDNT_BIND_SOCKET;
goto exit1;
}

// Listen on the socket for a connection, backlog = 5 deep (the max)
rc = listen(objListenSocket, SOMAXCONN);
if (rc == SOCKET_ERROR)
{
temprc = WSAGetLastError();
rc = XSRV_COULDNT_LISTEN_ON_SOCKET;
goto exit1;
}

// Use select to determine if there is any data on the listening
// socket. If not, don't try to accept. This keeps the accept from
// blocking.
// Initialize the select structure with listening socket.
FD_ZERO(&structReadFDS);
FD_SET(objListenSocket, &structReadFDS);

// Select timesout in 1/2 a second
temprc = select(NULL, &structReadFDS, NULL, NULL, &stTimeout);
// If error
if (temprc == SOCKET_ERROR)
{
temprc = WSAGetLastError();
rc = XSRV_COULDNT_SELECT;
goto exit2;
}