On Win64, can you tell me what sizeof(SOCKET) and sizeof(int) are? Try
this simple program:
----
#include <windows.h>
#include <winsock2.h>
int main(int argc, char[] *argv)
{
printf("sizeof(SOCKET) = %d, sizeof(int) = %d\n",
sizeof(SOCKET), sizeof(int));
return 0;
}
----
I just learned that on Win64, Microsoft *changed* the definition of
SOCKET from u_int to UINT_PTR:
/*
* The new type to be used in all
* instances which refer to sockets.
*/
#ifdef _WIN64
typedef UINT_PTR SOCKET;
#else
typedef u_int SOCKET;
#endif
Which means 64-bit SOCKET on Win64 vs. 32-bit SOCKET on Win32 or most
Unix-like systems.
...
The short answer is, yes, anywhere we have a variable that contains a
handle to a socket, we should use the SOCKET type, not a naked "int"
declaration, for portability.
On 8/4/11 10:28 AM, Maurizio Martignano wrote:
It is not a matter of understanding
It is a matter of testing
On Windows 64 int trigger[2] doesn't work whereas SOCKET trigger[2]
does work.
On top of that in several other places SOCKET has been used, so if for
no other reason, I suggest one of the code maintainers takes a proper
walk on the code base and make sure that all sockets are SOCKET
sockets and not int sockets...
--
Dossy Shiobara | "He realized the fastest way to change
[email protected] | is to laugh at your own folly -- then you
http://panoptic.com/ | can let go and quickly move on." (p. 70)
* WordPress * jQuery * MySQL * Security * Business Continuity *
--
AOLserver - http://www.aolserver.com/
To Remove yourself from this list, simply send an email to
<[email protected]> with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject:
field of your email blank.