SOCKET sampleSocket;
cout << sampleSocket << endl;
// End up with a number
I noticed that when I use cout to print a socket, I receive a number--what does that number represent and how can I retrieve it outside of using cout?
In Winsock applications, a socket descriptor is not a file descriptor and must be used with the Winsock functions. [...] Because the SOCKET type is unsigned, compiling existing source code from, for example, a UNIX environment may lead to compiler warnings about signed/unsigned data type mismatches.
(See Socket Data Type)
From this documentation we can gather that it is an unsigned
data type. However, the exact integer type remains implementation-defined. It will likely be a 32-bit or 64-bit unsigned
integer.