sk_tcp_set_private_ptr, sk_tcp_get_private_ptr, sk_tcp_set_frozen,
Socket sk_newlistener(int port, Plug plug, int local_host_only){    static struct socket_function_table fn_table = {	sk_tcp_plug,	sk_tcp_close,	sk_tcp_write,	sk_tcp_write_oob,	sk_tcp_flush,	sk_tcp_socket_error    };    SOCKET s;#ifdef IPV6    SOCKADDR_IN6 a6;#endif    SOCKADDR_IN a;    DWORD err;    char *errstr;    Actual_Socket ret;    int retcode;    int on = 1;    /*     * Create Socket structure.     */    ret = smalloc(sizeof(struct Socket_tag));    ret->fn = &fn_table;    ret->error = NULL;    ret->plug = plug;    bufchain_init(&ret->output_data);    ret->writable = 0;		       /* to start with */    ret->sending_oob = 0;    ret->frozen = 0;    ret->frozen_readable = 0;    ret->localhost_only = local_host_only;    ret->pending_error = 0;    /*     * Open socket.     */    s = socket(AF_INET, SOCK_STREAM, 0);    ret->s = s;    if (s == INVALID_SOCKET) {	err = WSAGetLastError();	ret->error = winsock_error_string(err);	return (Socket) ret;    }    ret->oobinline = 0;    setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (const char *)&on, sizeof(on));#ifdef IPV6	if (addr->family == AF_INET6) {	    memset(&a6, 0, sizeof(a6));	    a6.sin6_family = AF_INET6;	    if (local_host_only)		a6.sin6_addr = in6addr_loopback;	    else		a6.sin6_addr = in6addr_any;	    a6.sin6_port = htons(port);	} else#endif	{	    a.sin_family = AF_INET;	    if (local_host_only)		a.sin_addr.s_addr = htonl(INADDR_LOOPBACK);	    else		a.sin_addr.s_addr = htonl(INADDR_ANY);	    a.sin_port = htons((short)port);	}#ifdef IPV6	retcode = bind(s, (addr->family == AF_INET6 ?			   (struct sockaddr *) &a6 :			   (struct sockaddr *) &a),		       (addr->family ==			AF_INET6 ? sizeof(a6) : sizeof(a)));#else	retcode = bind(s, (struct sockaddr *) &a, sizeof(a));#endif	if (retcode != SOCKET_ERROR) {	    err = 0;	} else {	    err = WSAGetLastError();	}    if (err) {	ret->error = winsock_error_string(err);	return (Socket) ret;    }    if (listen(s, SOMAXCONN) == SOCKET_ERROR) {        closesocket(s);	ret->error = winsock_error_string(err);	return (Socket) ret;    }    /* Set up a select mechanism. This could be an AsyncSelect on a     * window, or an EventSelect on an event object. */    errstr = do_select(s, 1);    if (errstr) {	ret->error = errstr;	return (Socket) ret;    }    add234(sktree, ret);    return (Socket) ret;}