Bug 454 - Where is tcp-echo.cc?
Where is tcp-echo.cc?
Status: PATCH PENDING
Product: ns-3
Classification: Unclassified
Component: documentation
pre-release
All All
: P5 normal
Assigned To: natale.patriciello
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-12-22 13:42 EST by Craig Dowell
Modified: 2016-04-04 07:09 EDT (History)
4 users (show)

See Also:


Attachments
Patch that adds tcp-echo helper, testsuit, example, and so on (43.26 KB, patch)
2012-01-31 15:50 EST, Frank Helbert
Details | Diff
The same patch above with Ipv6 support and AddressPrinter class (51.57 KB, patch)
2012-02-10 13:36 EST, Frank Helbert
Details | Diff
TcpEcho classes (modified) (49.52 KB, patch)
2012-03-30 19:58 EDT, Tommaso Pecorella
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Craig Dowell 2008-12-22 13:42:33 EST
Pretty much every introduction to BSD sockets ever written uses a TCP echo client server pair to start with.  It then moves to a UDP echo client server pair to illustrate datagrams.

We wrote the udp-echo.cc example when there was no TCP in the system.  Now that we have some TCPs, it would be useful to make a tcp-echo.cc and associated applications.  In our documentation, it would be very useful go through the same kind of tutorial as everyone else in the world, with a tcp echo walkthrough followed by a udp echo walkthrough.

Currently, what is quite easy to do in the real world (find out how to write different flavors of sockets-based clients and servers) is much more hidden in ns-3.

This sounds like a good topic for a sockets chapter in the tutorial.
Comment 1 Frank Helbert 2012-01-31 15:50:49 EST
Created attachment 1321 [details]
Patch that adds tcp-echo helper, testsuit, example, and so on

We've done a helper.
We added some files under src/applications/model:
tcp-echo-client.cc
tcp-echo-client.h
tcp-echo-server.cc
tcp-echo-server.h
Under src/applications/helper:
tcp-echo-helper.cc
tcp-echo-helper.h
Under src/applications/test:
tcp-echo-test-suite.cc
Under examples/tcp:
tcp-echo-example.cc

We really appreciate any suggestions to improve the code.
Everything seems to run smooth.
Next step should be writing some pages to the tutorial, but we like some feedback for now.

Thanks,
Comment 2 Tommaso Pecorella 2012-02-02 19:25:21 EST
Nice job. Could you please post it to retveld (http://codereview.appspot.com/) so it's easier to read and comment ?

Also, we do have an incoming big patch about IPv6, TCP and UDP (see here: http://codereview.appspot.com/5417048/). I don't know if it will be merged earlier than this one, but:
- if the IPv6 patch is pushed earlier, please update your code accordingly so to support IPv6 addresses
- if tcp-echo is pushed earlier, please be ready to ... see above.
Ken did a great job updating all the existing examples, we don't want to give him more work, isn't it ?

Cheers,

Tommaso
Comment 3 Frank Helbert 2012-02-10 13:36:41 EST
Created attachment 1333 [details]
The same patch above with Ipv6 support and AddressPrinter class
Comment 4 Frank Helbert 2012-02-10 13:49:19 EST
Dear all,

Same patch ready for the incoming big patch about IPv6, TCP and UDP (http://codereview.appspot.com/5417048/).

Added some code to files address-utils.cc and address-utils.h to print Ipv4 and Ipv6 address easily (in human readable form), without the need to test what kind of address they are. Simple to use, just cast the address to AddressPrinter and ready.

Example:
NS_LOG_INFO ("Received " << packet->GetSize () << " bytes from " <<
    		  (AddressPrinter)from);

It doesn't matter of what type is the variable "from", if it is Ipv4Address, Ipv6Address, Address, InetSocketAddress, Inet6SocketAddress, it will print fine.

I think it will save many if's from source.

Cheers,
Frank
Comment 5 Frank Helbert 2012-02-10 14:29:15 EST
Now on http://codereview.appspot.com/5654053/ also.

(In reply to comment #4)
> Dear all,
> 
> Same patch ready for the incoming big patch about IPv6, TCP and UDP
> (http://codereview.appspot.com/5417048/).
> 
> Added some code to files address-utils.cc and address-utils.h to print Ipv4 and
> Ipv6 address easily (in human readable form), without the need to test what
> kind of address they are. Simple to use, just cast the address to
> AddressPrinter and ready.
> 
> Example:
> NS_LOG_INFO ("Received " << packet->GetSize () << " bytes from " <<
>               (AddressPrinter)from);
> 
> It doesn't matter of what type is the variable "from", if it is Ipv4Address,
> Ipv6Address, Address, InetSocketAddress, Inet6SocketAddress, it will print
> fine.
> 
> I think it will save many if's from source.
> 
> Cheers,
> Frank
Comment 6 Tommaso Pecorella 2012-03-30 19:58:37 EDT
Created attachment 1371 [details]
TcpEcho classes (modified)

Same as http://codereview.appspot.com/5654053/ but with the following changes:
1) my own comments fixed.
2) Copyright (mostly) fixed.
3) stripped out AddressPrinter class (I think we need a better solution).

T.
Comment 7 Brian Swenson 2013-04-08 10:28:55 EDT
Any reason not to commit this for upcoming release build?
Comment 8 Tom Henderson 2013-04-08 10:37:52 EDT
(In reply to comment #7)
> Any reason not to commit this for upcoming release build?

It is waiting for Frank to respond to Tommaso's comments (or to accept Tommaso's changes).
Comment 9 natale.patriciello 2016-04-04 07:08:54 EDT
Hi, have this some interest ? If yes, I will look into code, if not, close it as invalid (and link this to some wiki page for students' idea)