diff options
author | boris <boris@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2005-05-16 09:36:54 +0000 |
---|---|---|
committer | boris <boris@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2005-05-16 09:36:54 +0000 |
commit | e7272816abe1fe3b30363c1941b26ab6a1b790cb (patch) | |
tree | f121c88ffaa9863d417faa0c00fa728da705233c /examples | |
parent | 448305d11062013cccdae6de8f168a9076d3dbe2 (diff) | |
download | ATCD-e7272816abe1fe3b30363c1941b26ab6a1b790cb.tar.gz |
ChangeLogTag:Mon May 16 11:26:14 2005 Boris Kolpackov <boris@kolpackov.net>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/RMCast/Makefile.am | 13 | ||||
-rw-r--r-- | examples/RMCast/Send_Msg/Makefile.am | 56 | ||||
-rw-r--r-- | examples/RMCast/Send_Msg/Protocol.h | 18 | ||||
-rw-r--r-- | examples/RMCast/Send_Msg/README | 18 | ||||
-rw-r--r-- | examples/RMCast/Send_Msg/Receiver.cpp | 188 | ||||
-rw-r--r-- | examples/RMCast/Send_Msg/Send_Msg.mpc | 15 | ||||
-rw-r--r-- | examples/RMCast/Send_Msg/Sender.cpp | 51 |
7 files changed, 0 insertions, 359 deletions
diff --git a/examples/RMCast/Makefile.am b/examples/RMCast/Makefile.am deleted file mode 100644 index 3a8fba8cf07..00000000000 --- a/examples/RMCast/Makefile.am +++ /dev/null @@ -1,13 +0,0 @@ -## Process this file with automake to create Makefile.in -## -## $Id$ -## -## This file was generated by MPC. Any changes made directly to -## this file will be lost the next time it is generated. -## -## MPC Command: -## ./bin/mwc.pl -include /home/jtc/ACE/ACE-config3/MPC/config -include /home/jtc/ACE/ACE-config3/MPC/templates -type automake ACE.mwc - -SUBDIRS = \ - Send_Msg - diff --git a/examples/RMCast/Send_Msg/Makefile.am b/examples/RMCast/Send_Msg/Makefile.am deleted file mode 100644 index a7c9874b08f..00000000000 --- a/examples/RMCast/Send_Msg/Makefile.am +++ /dev/null @@ -1,56 +0,0 @@ -## Process this file with automake to create Makefile.in - -ACE_BUILDDIR = $(top_builddir) -ACE_ROOT = $(top_srcdir) - -noinst_PROGRAMS = - -## Makefile.Send_Msg_Receiver.am - -if BUILD_EXCEPTIONS - -noinst_PROGRAMS += receiver - -receiver_CPPFLAGS = \ - -I$(ACE_ROOT) \ - -I$(ACE_BUILDDIR) \ - -I$(ACE_ROOT)/protocols - -receiver_SOURCES = \ - Receiver.cpp \ - Protocol.h - -receiver_LDADD = \ - ${ACE_BUILDDIR}/protocols/ace/RMCast/libACE_RMCast.la \ - ${ACE_BUILDDIR}/ace/libACE.la - -endif BUILD_EXCEPTIONS - -## Makefile.Send_Msg_Sender.am - -if BUILD_EXCEPTIONS - -noinst_PROGRAMS += sender - -sender_CPPFLAGS = \ - -I$(ACE_ROOT) \ - -I$(ACE_BUILDDIR) \ - -I$(ACE_ROOT)/protocols - -sender_SOURCES = \ - Sender.cpp \ - Protocol.h - -sender_LDADD = \ - ${ACE_BUILDDIR}/protocols/ace/RMCast/libACE_RMCast.la \ - ${ACE_BUILDDIR}/ace/libACE.la - -endif BUILD_EXCEPTIONS - -## Clean up template repositories, etc. -clean-local: - -rm -f *~ *.bak *.rpo *.sym lib*.*_pure_* core core.* - -rm -f gcctemp.c gcctemp so_locations *.ics - -rm -rf cxx_repository ptrepository ti_files - -rm -rf templateregistry ir.out - -rm -rf ptrepository SunWS_cache Templates.DB diff --git a/examples/RMCast/Send_Msg/Protocol.h b/examples/RMCast/Send_Msg/Protocol.h deleted file mode 100644 index c3edf43b1fb..00000000000 --- a/examples/RMCast/Send_Msg/Protocol.h +++ /dev/null @@ -1,18 +0,0 @@ -// file : Protocol.h -// author : Boris Kolpackov <boris@kolpackov.net> -// cvs-id : $Id$ - -#ifndef PROTOCOL_H -#define PROTOCOL_H - -unsigned short const payload_size = 256; -unsigned long const message_count = 10000; - -struct Message -{ - unsigned long sn; - - unsigned short payload[payload_size]; -}; - -#endif // PROTOCOL_H diff --git a/examples/RMCast/Send_Msg/README b/examples/RMCast/Send_Msg/README deleted file mode 100644 index b02056bf0cf..00000000000 --- a/examples/RMCast/Send_Msg/README +++ /dev/null @@ -1,18 +0,0 @@ -In this example SENDER sends a number (defined in Protocol.h, 10000 -by default) of messages to the multicast group. Each message has -an application-level sequence number. RECEIVER tries to receive them -and checks for damaged, lost, and reordered messages. Since reliable -multicast is used there should be no damaged or reordered messages. -There could be some number of lost messages at the beginning, -howevere (standard race condition). - -To run the example start a one or more RECEIVERS, e.g., - -$ ./receiver 224.1.0.1:10000 - -Then start one SENDER: - -$ ./sender 224.1.0.1:10000 - --- -Boris Kolpackov <boris@kolpackov.net> diff --git a/examples/RMCast/Send_Msg/Receiver.cpp b/examples/RMCast/Send_Msg/Receiver.cpp deleted file mode 100644 index 39808151fe9..00000000000 --- a/examples/RMCast/Send_Msg/Receiver.cpp +++ /dev/null @@ -1,188 +0,0 @@ -// file : Receiver.cpp -// author : Boris Kolpackov <boris@kolpackov.net> -// cvs-id : $Id$ - -#include "ace/Vector_T.h" -#include "ace/Log_Msg.h" -#include "ace/OS_NS_string.h" - -#include "ace/RMCast/Socket.h" - -#include "Protocol.h" - -typedef -ACE_Vector<unsigned char, ACE_VECTOR_DEFAULT_SIZE> -Status_List; - -class args {}; - -int -ACE_TMAIN (int argc, ACE_TCHAR* argv[]) -{ - try - { - if (argc < 2) throw args (); - - ACE_INET_Addr addr (argv[1]); - - ACE_RMCast::Socket socket (addr, false); - - - Message expected_msg; - expected_msg.sn = 0; - - // VC6 does not know about the new rules. - // - { - for (unsigned short i = 0; i < payload_size; i++) - { - expected_msg.payload[i] = i; - } - } - - Status_List received (message_count); - Status_List damaged (message_count); - Status_List duplicate (message_count); - - // VC6 does not know about new rules. - // - { - for (unsigned long i = 0; i < message_count; ++i) - { - received.push_back (0); - damaged.push_back (0); - duplicate.push_back (0); - } - } - - - Message msg; - - while (true) - { - ssize_t s = socket.size (); - - if (s == -1 && errno == ENOENT) - { - ACE_ERROR ((LM_ERROR, "unavailable message detected\n")); - - // Receive it. - // - socket.recv (&msg, sizeof (msg)); - - continue; - } - - if (s != sizeof (msg)) - { - ACE_ERROR ((LM_ERROR, "unexpected message size %d, expected %d\n", - s, sizeof (msg))); - continue; - } - - if (socket.recv (&msg, sizeof (msg)) != s) - { - ACE_ERROR ((LM_ERROR, - "recv() reported different size than size()\n")); - continue; - } - - if (received[msg.sn] == 1) - { - duplicate[msg.sn] = 1; - } - else - { - received[msg.sn] = 1; - - if (ACE_OS::memcmp (expected_msg.payload, - msg.payload, - payload_size) != 0) - { - damaged[msg.sn] = 1; - } - } - - if (msg.sn + 1 == message_count) break; - } - - unsigned long lost_count (0), damaged_count (0), duplicate_count (0); - - { - for (Status_List::Iterator i (received); !i.done (); i.advance ()) - { - unsigned char* e; - i.next (e); - - if (*e == 0) ++lost_count; - } - } - - - { - for (Status_List::Iterator i (damaged); !i.done (); i.advance ()) - { - unsigned char* e; - i.next (e); - - if (*e == 1) ++damaged_count; - } - } - - - { - for (Status_List::Iterator i (duplicate); !i.done (); i.advance ()) - { - unsigned char* e; - i.next (e); - - if (*e == 1) ++duplicate_count; - } - } - - ACE_DEBUG ((LM_DEBUG, - "lost : %d\n" - "damaged : %d\n" - "duplicate : %d\n", - lost_count, - damaged_count, - duplicate_count)); - - /* - cout << "lost message dump:" << endl; - - unsigned long total = 0; - - for (Status_List::iterator - begin (received.begin ()), i (begin), end (received.end ()); - i != end;) - { - if (*i == 0) - { - unsigned long count = 1; - - for (Status_List::iterator j = i + 1; - j < end && *j == 0; - j++, count++); - - cout << '\t' << i - begin << " : " << count << endl; - - i += count; - total += count; - } - else ++i; - } - - if (total != lost_count) cerr << "trouble" << endl; - */ - - return 0; - } - catch (args const&) - { - ACE_ERROR ((LM_ERROR, - "usage: %s <IPv4 multicast address>:<port>\n", argv[0])); - } - - return 1; -} diff --git a/examples/RMCast/Send_Msg/Send_Msg.mpc b/examples/RMCast/Send_Msg/Send_Msg.mpc deleted file mode 100644 index 12bd8174c4b..00000000000 --- a/examples/RMCast/Send_Msg/Send_Msg.mpc +++ /dev/null @@ -1,15 +0,0 @@ -// -*- MPC -*- -// $Id$ - -project(*Sender) : aceexe, exceptions, rmcast { - exename = sender - Source_Files { - Sender.cpp - } -} -project(*Receiver) : aceexe, exceptions, rmcast { - exename = receiver - Source_Files { - Receiver.cpp - } -} diff --git a/examples/RMCast/Send_Msg/Sender.cpp b/examples/RMCast/Send_Msg/Sender.cpp deleted file mode 100644 index 19d570f249c..00000000000 --- a/examples/RMCast/Send_Msg/Sender.cpp +++ /dev/null @@ -1,51 +0,0 @@ -// 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]); - - ACE_RMCast::Socket socket (addr, false); - - 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 (50, 0)); - - return 0; - } - catch (args const&) - { - ACE_ERROR ((LM_ERROR, - "usage: %s <IPv4 multicast address>:<port>\n", argv[0])); - } - - return 1; -} |