Click to See Complete Forum and Search --> : select() fails with 10038 porting on 64 bit


TdUser
June 10th, 2010, 04:40 PM
Hi

I'm currently trying to port my working application from 32 bit to 64 bit.
I see that the select() fails with error 10038. I did some research to find out the cause but
unable to drill it to the root cause. Im doubting it's to do with 32 and 64 bit models.
I tried to type cast based on some articles "converting from 32 bit to 64 bit " but no luck.
Any help is highly appreciated..... Thanks in advance

typedef struct {
SOCKET s;
Boolean Valid;
}Sock_Type, *Sock_Ptr_Type;

****************
Sock_Ptr_Type sockp;
fd_set rfds, wfds, efds;
struct timeval tv;
int n;
tv.tv_sec = 5;
tv.tv_usec = 0;
FD_ZERO(&rfds);
FD_ZERO(&wfds);
FD_ZERO(&efds);

for(int sockcnt=0;sockcnt<2;sockcnt++)
{
if(sockp[sockcnt].Valid)
{
FD_SET(sockp[sockcnt].s,&rfds);
FD_SET(sockp[sockcnt].s,&wfds);
FD_SET(sockp[sockcnt].s,&efds);
}
}

SOCKET temp = sockp[0].s;
n = select(temp+1,&rfds,&wfds,&efds,&tv);

***********

Error from select(): 10038
An operation was attempted on something that is not a socket. The specified socket parameter refers to a file, not a socket.

hoxsiew
June 10th, 2010, 05:55 PM
Please use tags around your code to make it easier to read.

What type is "Boolean" in your Sock_Ptr_Type? It's not a standard type. It may be the problem if it is different widths in 64 v. 32bit environments.

TdUser
June 11th, 2010, 12:22 PM
Boolean is unsigned char

VictorN
June 11th, 2010, 12:32 PM
Boolean is unsigned charWell, why is it not declared according to C++ standard as bool?