diff --git a/simgear/io/raw_socket.cxx b/simgear/io/raw_socket.cxx index 54b1177c..e2adb7ee 100644 --- a/simgear/io/raw_socket.cxx +++ b/simgear/io/raw_socket.cxx @@ -199,8 +199,13 @@ bool Socket::open ( bool stream ) // if ( stream ) { int opt_boolean = 1; - setsockopt( handle, SOL_SOCKET, SO_REUSEADDR, - (char *)&opt_boolean, sizeof(opt_boolean) ); +#if defined(_WIN32) || defined(__CYGWIN__) + setsockopt( handle, SOL_SOCKET, SO_REUSEADDR, (char *)&opt_boolean, + sizeof(opt_boolean) ); +#else + setsockopt( handle, SOL_SOCKET, SO_REUSEADDR, &opt_boolean, + sizeof(opt_boolean) ); +#endif } return (handle != -1);