int type = 0; if (atmark==0) { ioctlsocket(s->s, SIOCATMARK, &atmark); if(atmark) type = 2; else type = 1; } return s->receiver(s, type, buf, ret);
return s->receiver(s, atmark ? 0 : 1, buf, ret);
int select_result(WPARAM wParam, LPARAM lParam) {    int ret, open;    DWORD err;    char buf[BUFFER_GRANULE];    Socket s;    u_long atmark;    /* wParam is the socket itself */    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         * receiver function.         */        return s->receiver(s, 3, winsock_error_string(err), err);    }    noise_ultralight(lParam);    switch (WSAGETSELECTEVENT(lParam)) {      case FD_READ:        atmark = 1;        /* Some WinSock wrappers don't support this call, so we         * deliberately don't check the return value. If the call         * fails and does nothing, we will get back atmark==1,         * which is good enough to keep going at least. */        ioctlsocket(s->s, SIOCATMARK, &atmark);	ret = recv(s->s, buf, sizeof(buf), 0);	if (ret < 0) {	    err = WSAGetLastError();	    if (err == WSAEWOULDBLOCK) {		break;	    }	}	if (ret < 0) {	    return s->receiver(s, 3, winsock_error_string(err), err);	} else {            int type = 0;	    if (atmark==0) {		ioctlsocket(s->s, SIOCATMARK, &atmark);		if(atmark) type = 2; else type = 1;	    }	    return s->receiver(s, type, buf, ret);	}	break;      case FD_OOB:	/*	 * Read all data up to the OOB marker, and send it to the	 * receiver with urgent==1 (OOB pending).	 */        ret = recv(s->s, buf, sizeof(buf), MSG_OOB);        noise_ultralight(ret);        if (ret <= 0) {            fatalbox(ret == 0 ? "Internal networking trouble" :                     winsock_error_string(WSAGetLastError()));        } else {            return s->receiver(s, 2, buf, ret);        }        break;      case FD_WRITE:	s->writable = 1;	try_send(s);	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 s->receiver(s, 3, winsock_error_string(err), err);            } else                open &= s->receiver(s, 0, buf, ret);	} while (ret > 0);        return open;    }    return 1;}