TCP disconnect
ns-2 has some basic web traffic models that seem to be a SURGE implementation. Coding wise they are a bit nasty, with callbacks to OTcl from C++ everywhere. I imagine that has a significant performance impact? But lets ignore that, it isn’t critical.
The models seem to work fine with the normal one-way TCP, but get some nasty errors when using FullTcp.
0.100090: FullTcpAgent::recv(_o659): bad ACK for our SYN: [24:2.1>0.1]
(hlen:40, dlen:0, seq:1002, ack:2, flags:0x18 (<PSH,ACK>), salen:0, reason:0x0)
0.100120: FullTcpAgent::recv(_o660) got packet lacking ACK (state:3): [29:0.1>2.1]
(hlen:40, dlen:0, seq:2, ack:0, flags:0x0 (<null>), salen:0, reason:0x0)
While I often try and stay away from the FullTcp-based models, I see it as a requisite when:
- We are doing bidirectional data transfer – the request has a size too!
- The unidirectional TCP models don’t segment data over packets properly. Each data packet is always full size. So if the MSS is 1000 and you want to send 1001 bytes, you end up sending two full size packets. This seems quite ridiculous to me and makes it very hard to control the presented load on the network.
So I wrote my own SURGE based model in C++ for ns-2. I stayed away from OTcl. It seemed to be working fine, then I wanted to add the functionality of actually doing a connection establishment for every page and object. Or at least every page. Connecting is easy, it is the disconnecting that is annoying. The API is not exposed to C++ and then the entire process seems very buggy. I just want my FullTcp agent to disconnect properly and reset itself so it may be re-used for the next connection. But no, trying to get the combination of FINS correct seems to be very hard. I don’t know what the FullTcp agent is doing, but it looks very wrong. A way to get around this problem is just to keep allocating new TCP objects whenever a new connection is required. This is how the other model works as far as I know. Seems like a silly solution when you could just reuse the existing stuff.
This was supposed to be an easy activity I would have coded up quickly this morning. It is now almost 2pm and I don’t have a good answer.
Someone should get some real world network stacks that work properly, and put them in a network simulator. Wouldn’t that be a good idea!