Win32 Port

Tor Lillqvist tml at iki.fi
Tue May 2 00:45:36 PDT 2006


 > > Just curious - is your isSocket() something like _get_osfhandle()<0 ? Or
 > > did you find a better WinAPI that answers the handle type precisely ?

 > I used the return code of getsockopt(), which is zero for socket file
 > types  and  -1  for non socket type.

But what if the same integer happens to be both a socket and a file
descriptor...? Overlap (i.e. smallish socket numbers) can very well
happen. I once had a test program to check this but can't find it
right now, but IIRC you didn't even have to try very hard to get
overlap (no need to open a stupendous amount of files or sockets).

Having the file/socket separation spelled out in the API is
unfortunately the only reliable way to handle this.

--tml



More information about the dbus mailing list