Q: How to set a socket option?
A: Socket options can be set using the 'setsockopt()' function. The following shows the usage for the 'SO_REUSEADDR' option (others are set the same way).
Code:int iOptval = 1; if(::setsockopt(Socket, SOL_SOCKET, SO_REUSEADDR, (char *) &iOptval, sizeof(int))) // Error -> call ::WSAGetLastError()