ret->head = ret->tail = NULL;
bufchain_init(&ret->output_data);
Socket sk_register(void *sock, Plug plug){    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    };    DWORD err;    char *errstr;    Actual_Socket ret;    /*     * Create Socket structure.     */    ret = smalloc(sizeof(struct Socket_tag));    ret->fn = &fn_table;    ret->error = NULL;    ret->plug = plug;    ret->head = ret->tail = NULL;    ret->writable = 1;		       /* to start with */    ret->sending_oob = 0;    ret->frozen = 1;    ret->s = (SOCKET)sock;    if (ret->s == INVALID_SOCKET) {	err = WSAGetLastError();	ret->error = winsock_error_string(err);	return (Socket) ret;    }    ret->oobinline = 0;    /* Set up a select mechanism. This could be an AsyncSelect on a     * window, or an EventSelect on an event object. */    errstr = do_select(ret->s, 1);    if (errstr) {	ret->error = errstr;	return (Socket) ret;    }    add234(sktree, ret);    return (Socket) ret;}