Changes to attempt to silence bcc64x
[ACE_TAO.git] / TAO / orbsvcs / tests / Miop / McastLocal / client.cpp
blob82ce5ecd2aa7d8edf387ed0446e6f032bc3937a7
1 #include "TestC.h"
2 #include "ace/Get_Opt.h"
3 #include "tao/Object_T.h"
4 #include "orbsvcs/PortableGroup/MIOP.h"
7 #define MAX_MIOP_OCTET_SEQUENCE (ACE_MAX_DGRAM_SIZE - 272 /* MIOP_MAX_HEADER_SIZE */)
9 const ACE_TCHAR *ior = ACE_TEXT("file://test.ior");
11 int
12 parse_args (int argc, ACE_TCHAR *argv[])
14 ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:"));
15 int c;
17 while ((c = get_opts ()) != -1)
18 switch (c)
20 case 'k':
21 ior = get_opts.opt_arg ();
22 break;
24 case '?':
25 default:
26 ACE_ERROR_RETURN ((LM_ERROR,
27 "usage: %s "
28 "-k <ior> "
29 "\n",
30 argv [0]),
31 -1);
33 // Indicates successful parsing of the command line
34 return 0;
37 int
38 ACE_TMAIN(int argc, ACE_TCHAR *argv[])
40 try
42 CORBA::ORB_var orb =
43 CORBA::ORB_init (argc, argv);
45 if (parse_args (argc, argv) != 0)
46 return 1;
48 CORBA::Object_var tmp =
49 orb->string_to_object(ior);
51 /* Do an unchecked narrow since there's no way to do an is_a on
52 * a multicast reference (yet...).
54 Test::McastHello_var hello =
55 TAO::Narrow_Utils<Test::McastHello>::unchecked_narrow (
56 tmp.in ());
58 if (CORBA::is_nil (hello.in ()))
60 ACE_ERROR_RETURN ((LM_DEBUG,
61 "Nil Test::Hello reference <%s>\n",
62 ior),
63 1);
66 hello->send_forty_two (42);
68 Test::Octets payload (MAX_MIOP_OCTET_SEQUENCE);
69 payload.length (MAX_MIOP_OCTET_SEQUENCE);
71 for (CORBA::ULong j = 0; j != MAX_MIOP_OCTET_SEQUENCE; ++j)
73 payload[j] = j % 256;
76 hello->send_large_octet_array (payload);
78 hello->shutdown ();
80 orb->destroy ();
82 catch (const CORBA::Exception& ex)
84 ex._tao_print_exception ("Exception caught:");
85 return 1;
88 return 0;