ioctlsocket(s->s, SIOCATMARK, &atmark);
p_ioctlsocket(s->s, SIOCATMARK, &atmark);
int select_result(WPARAM wParam, LPARAM lParam){    int ret, open;    DWORD err;    char buf[20480];		       /* nice big buffer for plenty of speed */    Actual_Socket s;    u_long atmark;    /* wParam is the socket itself */    if (wParam == 0)	return 1;		       /* boggle */    s = find234(sktree, (void *) wParam, cmpforsearch);    if (!s)	return 1;		       /* boggle */    if ((err = WSAGETSELECTERROR(lParam)) != 0) {	/*	 * An error has occurred on this socket. Pass it to the	 * plug.	 */	return plug_closing(s->plug, winsock_error_string(err), err, 0);    }    noise_ultralight(lParam);    switch (WSAGETSELECTEVENT(lParam)) {      case FD_CONNECT:	s->connected = s->writable = 1;	break;      case FD_READ:	/* In the case the socket is still frozen, we don't even bother */	if (s->frozen) {	    s->frozen_readable = 1;	    break;	}	/*	 * We have received data on the socket. For an oobinline	 * socket, this might be data _before_ an urgent pointer,	 * in which case we send it to the back end with type==1	 * (data prior to urgent).	 */	if (s->oobinline) {	    atmark = 1;	    ioctlsocket(s->s, SIOCATMARK, &atmark);	    /*	     * Avoid checking the return value from ioctlsocket(),	     * on the grounds that some WinSock wrappers don't	     * support it. If it does nothing, we get atmark==1,	     * which is equivalent to `no OOB pending', so the	     * effect will be to non-OOB-ify any OOB data.	     */	} else	    atmark = 1;	ret = recv(s->s, buf, sizeof(buf), 0);	noise_ultralight(ret);	if (ret < 0) {	    err = WSAGetLastError();	    if (err == WSAEWOULDBLOCK) {		break;	    }	}	if (ret < 0) {	    return plug_closing(s->plug, winsock_error_string(err), err,				0);	} else if (0 == ret) {	    return plug_closing(s->plug, NULL, 0, 0);	} else {	    return plug_receive(s->plug, atmark ? 0 : 1, buf, ret);	}	break;      case FD_OOB:	/*	 * This will only happen on a non-oobinline socket. It	 * indicates that we can immediately perform an OOB read	 * and get back OOB data, which we will send to the back	 * end with type==2 (urgent data).	 */	ret = recv(s->s, buf, sizeof(buf), MSG_OOB);	noise_ultralight(ret);	if (ret <= 0) {	    char *str = (ret == 0 ? "Internal networking trouble" :			 winsock_error_string(WSAGetLastError()));	    /* We're inside the Windows frontend here, so we know	     * that the frontend handle is unnecessary. */	    logevent(NULL, str);	    fatalbox("%s", str);	} else {	    return plug_receive(s->plug, 2, buf, ret);	}	break;      case FD_WRITE:	{	    int bufsize_before, bufsize_after;	    s->writable = 1;	    bufsize_before = s->sending_oob + bufchain_size(&s->output_data);	    try_send(s);	    bufsize_after = s->sending_oob + bufchain_size(&s->output_data);	    if (bufsize_after < bufsize_before)		plug_sent(s->plug, bufsize_after);	}	break;      case FD_CLOSE:	/* Signal a close on the socket. First read any outstanding data. */	open = 1;	do {	    ret = recv(s->s, buf, sizeof(buf), 0);	    if (ret < 0) {		err = WSAGetLastError();		if (err == WSAEWOULDBLOCK)		    break;		return plug_closing(s->plug, winsock_error_string(err),				    err, 0);	    } else {		if (ret)		    open &= plug_receive(s->plug, 0, buf, ret);		else		    open &= plug_closing(s->plug, NULL, 0, 0);	    }	} while (ret > 0);	return open;       case FD_ACCEPT:	{	    struct sockaddr_in isa;	    int addrlen = sizeof(struct sockaddr_in);	    SOCKET t;  /* socket of connection */	    memset(&isa, 0, sizeof(struct sockaddr_in));	    err = 0;	    t = accept(s->s,(struct sockaddr *)&isa,&addrlen);	    if (t == INVALID_SOCKET)	    {		err = WSAGetLastError();		if (err == WSATRY_AGAIN)		    break;	    }	    if (s->localhost_only && !ipv4_is_loopback(isa.sin_addr)) {		closesocket(t);	       /* dodgy WinSock let nonlocal through */	    } else if (plug_accepting(s->plug, (void*)t)) {		closesocket(t);	       /* denied or error */	    }	}    }    return 1;}