Bug 508

Summary: [contribution] udp-echo-client modifications
Product: ns-3 Reporter: Tom Henderson <tomh>
Component: applicationsAssignee: ns-bugs <ns-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: craigdo
Priority: P5    
Version: ns-3-dev   
Hardware: All   
OS: All   
Attachments: .cc file
.h file

Description Tom Henderson 2009-02-23 00:56:47 EST
(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
Comment 1 Tom Henderson 2009-02-23 00:57:13 EST
Created attachment 384 [details]
.cc file
Comment 2 Tom Henderson 2009-02-23 00:57:36 EST
Created attachment 385 [details]
.h file
Comment 3 Craig Dowell 2009-06-23 22:49:12 EDT
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