len = s->head->buflen - s->head->bufpos;
bufchain_prefix(&s->output_data, &data, &len);
void try_send(Actual_Socket s){    if (s->frozen) return;    while (s->head) {	int nsent;	DWORD err;	int len, urgentflag;	if (s->sending_oob) {	    urgentflag = MSG_OOB;	    len = s->sending_oob;	} else {	    urgentflag = 0;	    len = s->head->buflen - s->head->bufpos;	}	nsent =	    send(s->s, s->head->buf + s->head->bufpos, len, urgentflag);	noise_ultralight(nsent);	if (nsent <= 0) {	    err = (nsent < 0 ? WSAGetLastError() : 0);	    if ((err == 0 && nsent < 0) || err == WSAEWOULDBLOCK) {		/*		 * Perfectly normal: we've sent all we can for the moment.		 * 		 * (Apparently some WinSocks can return <0 but		 * leave no error indication - WSAGetLastError() is		 * called but returns zero - so we check that case		 * and treat it just like WSAEWOULDBLOCK.)		 */		s->writable = FALSE;		return;	    } else if (nsent == 0 ||		       err == WSAECONNABORTED || err == WSAECONNRESET) {		/*		 * FIXME. This will have to be done better when we		 * start managing multiple sockets (e.g. SSH port		 * forwarding), because if we get CONNRESET while		 * trying to write a particular forwarded socket		 * then it isn't necessarily the end of the world.		 * Ideally I'd like to pass the error code back to		 * somewhere the next select_result() will see it,		 * but that might be hard. Perhaps I should pass it		 * back to be queued in the Windows front end bit.		 */		fatalbox(winsock_error_string(err));	    } else {		fatalbox(winsock_error_string(err));	    }	} else {	    s->head->bufpos += nsent;	    if (s->sending_oob)		s->sending_oob -= nsent;	    if (s->head->bufpos >= s->head->buflen) {		struct buffer *tmp = s->head;		s->head = tmp->next;		sfree(tmp);		if (!s->head)		    s->tail = NULL;	    }	}    }}