NOEXPORT SOCK_OPT *socket_options_init(void) {
#ifdef USE_WIN32
    DWORD version;
    int major, minor;
#endif

    SOCK_OPT *opt=str_alloc_detached(sizeof sock_opts_def);
    memcpy(opt, sock_opts_def, sizeof sock_opts_def);

#ifdef USE_WIN32
    version=GetVersion();
    major=LOBYTE(LOWORD(version));
    minor=HIBYTE(LOWORD(version));
    s_log(LOG_DEBUG, "Running on Windows %d.%d", major, minor);

    if(major>5) /* Vista or later */
        socket_option_set_int(opt, "SO_EXCLUSIVEADDRUSE", 0, 1); /* accepting socket */
#else
    socket_option_set_int(opt, "SO_REUSEADDR", 0, 1); /* accepting socket */
#endif
    socket_option_set_int(opt, "TCP_NODELAY", 1, 1); /* local socket */
    socket_option_set_int(opt, "TCP_NODELAY", 2, 1); /* remote socket */
    return opt;
}
NOEXPORT SOCK_OPT *socket_options_init(void) {
#ifdef USE_WIN32
    DWORD version;
    int major, minor;
#endif

    SOCK_OPT *opt=str_alloc_detached(sizeof sock_opts_def);
    memcpy(opt, sock_opts_def, sizeof sock_opts_def);

#ifdef USE_WIN32
    version=GetVersion();
    major=LOBYTE(LOWORD(version));
    minor=HIBYTE(LOWORD(version));
    s_log(LOG_DEBUG, "Running on Windows %d.%d", major, minor);

    if(major>5)  
        socket_option_set_int(opt, "SO_EXCLUSIVEADDRUSE", 0, 1);  
#else
    socket_option_set_int(opt, "SO_REUSEADDR", 0, 1);  
#endif
    socket_option_set_int(opt, "TCP_NODELAY", 1, 1);  
    socket_option_set_int(opt, "TCP_NODELAY", 2, 1);  
    return opt;
}