Henrik Nordstrom wrote:
On Tue, 21 Sep 2004, Eric Dumazet wrote:
I discovered today that some TCP stacks were able to initiate TCP sockets with 2 packets "only".
The third packet (ACK packet) is just delayed and integrated into the data packet.
The TCP standard even allows you to have data in the SYN packet if you like. There however needs to be an exchange of three packets before the connection is considered established. The SYN flag is just like "octet 0" in the data stream of from sending direction. SYN + data is just that. As having data in the SYN or SYN+ACK packets is very uncommon not all TCP stacks are prepared to handle this and is therefore not recommended.
All should handle a data payload in the ACK packet I think however, but there may obviously be some odd ones which does not.
Is it possible to achieve the same thing with linux 2.4/2.6, for connections initiated by us ?
Looking at the kernel source... seems to be the case if you simply initiate a non-blocking connect and then queue some data to be sent on the connection while the connect is taking place. Testing.. yes this does work.
set non-blocking connect set blocking
Thank you for the hint. But the "set blocking" makes me nervous, since I need to be sure not to block at write()/send() time...
write
Regards Henrik
- : 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