Multi-connection TCP server callback

62 views
Skip to first unread message

harald...@gmail.com

unread,
Oct 11, 2016, 7:32:14 AM10/11/16
to ns-3-users
I'll try to make it as short as possible:
I want to have a TCP server that can serve multiple clients at the same time.
The clients send messages containing a string, which holds the number of bytes the server is supposed to send them back.
No actual data, just dummy data.
I thereby want to simulate video streaming traffic, with clients requesting segments from the server (as in HTTP DASH).

Everything is in place so far, until now I've set the SndBufSize and RcvBufSize to some high enough value, so I can send as 
many bytes as necessary through a single SendTo () call. 
But the model is supposed to be generic, and as there are potentially multiple clients, which during the simulation might request 
potentially very large segment sizes,
I can't just set the max buffer to some fixed value.
Even though one could just pick the largest existing value that will be requested during the simulation 
(these will be passed as a 2x2 matrix as a .txt file in the beginning),
maybe someone will want to simulate packet loss, so the buffer won't be large enough.

So I've implemented a server model with a SendCallback.
But the problem is that during the simulation, when the server is supposed to send a 
packet > 131072 (max standard buffer size), the SetSendCallback () somehow doesn't fire, even though after the buffer has enough free space because the client has received the "first part".
SendTo () returns -1, then the client receives all the packets, and after that the callback is supposed to fire (see line 191 in my script)

tcp-stream-server.cc
tcp-stream-server.h
Reply all
Reply to author
Forward
0 new messages