> > 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). If the send is large, then we *must* send at least several frames. Only the last one will have the FIN piggybacked (of course !) > > Otherwise, the send will be successful in sending out > the segment, and the FIN will still be sent separately > (once the shutdown call executes). No, the last frame *will* carry over the FIN flag. If you dont use CORK, the kernel *could* send the DATA, then send a FIN packet without DATA. Or do you only care of the send() syscall doing a partial send , i.e returns a result < asked length ? If yes, just use a safe_send() that does the necessary retries... > > Also, this isn't saving you a system call, right? > You are still doing a send+shutdown.. Yes, of course, but my main concern is to save bandwidth. A separate FIN costs a full TCP packet, instead of reusing one bit on the last Data packet. 40 bytes saved out of 40+84+40, that is a 25% saving... > > > 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(?). Well, for a server handling hundreds of connections requests/second, the saving can be quite huge indeed. > > > 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 > Eric - : 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