Pat asked me a while back:
I need to port code to WIN64. Sockets descriptors are now 64 bits on WIN64 (type SOCKET). Socket API now uses the SOCKET type. The problem I have is that the code I need to port uses I/O function read, write and close giving the socket file descriptor to to the operations. Those functions are still using a 32 bits descriptor.
What would be the clean way to port ?
Is it a problem now to use the socket descriptor as a file descriptor ?
Why is the socket descriptor need to be 64 bits ? I don`t see any gain…
My Reply:
Winsock has ALWAYS used the SOCKET type. Code it up properly! Do not use file I/O, use socket I/O. It also makes the code more portable to other platforms.
Does it really matter? Microsoft will not change it at this point! Anyway, that is the whole point of using types like SOCKET; they can be updated or redefined without changing your code.
I love to answer programming questions. Feel free to send me your questions. Use the subject “Ask Phil” to insure I spot it, and I will do my best to get you a useful answer. I will also pick a few each week and post them here.