sockets - Simulate a continuous client-server communication in ns3 -
i want simulate simple continuous client-server request-response behaviour; i.e. client sends packet server, server receives packet , responds client, client receives response packet , again sends out new packet server , on. have figured out send 1 round of communication (client->server->client) don't know how continue this. code achieve 1 round:
udpechoserverhelper echoserver (9); applicationcontainer serverapps = echoserver.install (wifiapnode.get (nwifiap - 1)); serverapps.start (seconds (1.0)); serverapps.stop (seconds (10.0)); udpechoclienthelper echoclient (apdevicesinterfaces.getaddress (nwifiap - 1), 9); echoclient.setattribute ("maxpackets", uintegervalue (1)); echoclient.setattribute ("interval", timevalue (seconds (1.0))); echoclient.setattribute ("packetsize", uintegervalue (1024)); applicationcontainer clientapps; clientapps = echoclient.install (wifistanodes.get (nwifista - 1)); clientapps.start (seconds (2.0)); clientapps.stop (seconds (10.0));
if set other int 1 in echoclient.setattribute ("maxpackets", uintegervalue (1));
, able have many rounds problem start @ 1 second gap (due this: echoclient.setattribute ("interval", timevalue (seconds (1.0)));
). want client starts sending out receives response server , not after waiting 1 second.
you need modify echoclient application , in particularly 'handleread' method respnsible reception of packets. prints 1 received. take @ udpechoserver application, handleread generating response.
Comments
Post a Comment