diff options
author | William R. Otte <wotte@dre.vanderbilt.edu> | 2006-07-24 15:50:30 +0000 |
---|---|---|
committer | William R. Otte <wotte@dre.vanderbilt.edu> | 2006-07-24 15:50:30 +0000 |
commit | c44379cc7d9c7aa113989237ab0f56db12aa5219 (patch) | |
tree | 66a84b20d47f2269d8bdc6e0323f338763424d3a /ACE/protocols/tests/RMCast/Sender.cpp | |
parent | 3aff90f4a822fcf5d902bbfbcc9fa931d6191a8c (diff) | |
download | ATCD-c44379cc7d9c7aa113989237ab0f56db12aa5219.tar.gz |
Repo restructuring
Diffstat (limited to 'ACE/protocols/tests/RMCast/Sender.cpp')
-rw-r--r-- | ACE/protocols/tests/RMCast/Sender.cpp | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/ACE/protocols/tests/RMCast/Sender.cpp b/ACE/protocols/tests/RMCast/Sender.cpp new file mode 100644 index 00000000000..85340b6b4a0 --- /dev/null +++ b/ACE/protocols/tests/RMCast/Sender.cpp @@ -0,0 +1,53 @@ +// file : Sender.cpp +// author : Boris Kolpackov <boris@kolpackov.net> +// cvs-id : $Id$ + +#include "ace/OS.h" +#include "ace/Log_Msg.h" + +#include "ace/RMCast/Socket.h" + +#include "Protocol.h" + +class args {}; + +int +ACE_TMAIN (int argc, ACE_TCHAR* argv[]) +{ + try + { + if (argc < 2) throw args (); + + ACE_INET_Addr addr (argv[1]); + + // Turn on message loss and reordering simulation. + // + ACE_RMCast::Socket socket (addr, false, true); + + Message msg; + msg.sn = 0; + + for (unsigned short i = 0; i < payload_size; i++) + { + msg.payload[i] = i; + } + + for (; msg.sn < message_count; msg.sn++) + { + socket.send (&msg, sizeof (msg)); + } + + // Keep running in case retransmissions are needed. + // + ACE_OS::sleep (ACE_Time_Value (60, 0)); + + return 0; + } + catch (args const&) + { + ACE_ERROR ((LM_ERROR, + "usage: %s <IPv4 multicast address>:<port>\n", argv[0])); + } + + return 1; +} |