Changes to attempt to silence bcc64x
[ACE_TAO.git] / TAO / orbsvcs / tests / Miop / McastHello / client.cpp
blob71b4daec197766caa14a915a3448fc9c5ee49cdf
1 #include "TestC.h"
2 #include "ace/Get_Opt.h"
3 #include "tao/Object_T.h"
4 #include "orbsvcs/PortableGroup/MIOP.h"
6 #define MAX_MIOP_OCTET_SEQUENCE (ACE_MAX_DGRAM_SIZE - 272 /* MIOP_MAX_HEADER_SIZE */)
8 const ACE_TCHAR *ior = ACE_TEXT("file://test.ior");
10 int
11 parse_args (int argc, ACE_TCHAR *argv[])
13 ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:"));
14 int c;
16 while ((c = get_opts ()) != -1)
17 switch (c)
19 case 'k':
20 ior = get_opts.opt_arg ();
21 break;
23 case '?':
24 default:
25 ACE_ERROR_RETURN ((LM_ERROR,
26 "usage: %s "
27 "-k <ior> "
28 "\n",
29 argv [0]),
30 -1);
32 // Indicates successful parsing of the command line
33 return 0;
36 int
37 ACE_TMAIN(int argc, ACE_TCHAR *argv[])
39 try
41 CORBA::ORB_var orb =
42 CORBA::ORB_init (argc, argv);
44 if (parse_args (argc, argv) != 0)
45 return 1;
47 CORBA::Object_var tmp =
48 orb->string_to_object(ior);
50 /* Do an unchecked narrow since there's no way to do an is_a on
51 * a multicast reference (yet...).
53 Test::McastHello_var hello =
54 TAO::Narrow_Utils<Test::McastHello>::unchecked_narrow (
55 tmp.in ());
57 if (CORBA::is_nil (hello.in ()))
59 ACE_ERROR_RETURN ((LM_DEBUG,
60 "Nil Test::Hello reference <%s>\n",
61 ior),
62 1);
65 hello->send_forty_two (42);
67 Test::Octets payload (MAX_MIOP_OCTET_SEQUENCE);
68 payload.length (MAX_MIOP_OCTET_SEQUENCE);
70 for (CORBA::ULong j = 0; j != MAX_MIOP_OCTET_SEQUENCE; ++j)
72 payload[j] = j % 256;
75 hello->send_large_octet_array (payload);
77 hello->shutdown ();
79 orb->destroy ();
81 catch (const CORBA::Exception& ex)
83 ex._tao_print_exception ("Exception caught:");
84 return 1;
87 return 0;