Bugzilla – Bug 508
[contribution] udp-echo-client modifications
Last modified: 2009-06-23 22:49:12 EDT
(from ns-developers post, Feb. 6 2009) Hi all, We've made some modifications to the udp-echo-client application to be able to add a text string as data in the packets. A example of use will be in the definition of the echoClient, adding: echoClient.SetAttribute ("MaxPackets", UintegerValue (1)); echoClient.SetAttribute ("Interval", TimeValue (Seconds (5.))); echoClient.SetAttribute ("PacketSize", UintegerValue (1024)); echoClient.SetAttribute ("PacketData", StringValue("Hello world"); Regards, CITIC
Created attachment 384 [details] .cc file
Created attachment 385 [details] .h file
changeset: 84c133267507 There were some issues with buffer overflows and consistency problems, so I massaged this a bit and added some capabilities. See udp-echo.cc example for user visible API: UdpEchoClientHelper client (i.GetAddress (1), port); ... #if 0 // // Users may find it convenient to initialize echo packets with actual data; // the below lines suggest how to do this // client.SetFill(apps.Get (0), "Hello World"); client.SetFill(apps.Get (0), 0xa5, 1024); uint8_t fill[] = {0, 1, 2, 3, 4, 5, 6}; client.SetFill(apps.Get (0), fill, sizeof(fill), 1024); #endif