dada1 wrote:
I found the answer... I include it here for completion.
int on = 1 ;
setsockopt(fd, SOL_TCP, TCP_CORK, &on, sizeof(int)) ;
send(fd, buffer, length, 0) ;
shutdown(fd, 2) ;
I believe the TCP_CORK will only hold up the segment
if its not full sized (i.e. whatever the mss is then)
(barring some other reason to hold up the send).
Otherwise, the send will be successful in sending out
the segment, and the FIN will still be sent separately
(once the shutdown call executes).
Also, this isn't saving you a system call, right?
You are still doing a send+shutdown..
send(fd, buffer, 84, 0) ;
shutdown(fd, 2) ;
05:00:17.242008 hostA.80 > hostB.2159: P 1:85(84) ack 1 win 5840 (DF)
05:00:17.242041 hostA.80 > hostB.2159: F 85:85(0) ack 1 win 5840 (DF)
And even if you were successful in merging the two,
given that the difference is .000033s (because
we dont hold up the FIN), its going to be hardly visible
in the grand scheme of things(?).
with :
/* some clever api... */
send_and_shutdown(fd, buffer, 84, FLAGS) ;
05:00:17.242008 hostA.80 > hostB.2159: PF 1:85(84) ack 1 win 5840 (DF)
thanks,
Nivedita
-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html