1 #include "ace/Get_Opt.h"
3 #include "ace/OS_NS_unistd.h"
5 const ACE_TCHAR
*ior
= ACE_TEXT("file://test.ior");
9 parse_args (int argc
, ACE_TCHAR
*argv
[])
11 ACE_Get_Opt
get_opts (argc
, argv
, ACE_TEXT("n:"));
14 while ((c
= get_opts ()) != -1)
18 num_calls
= ACE_OS::atoi (get_opts
.opt_arg ());
27 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
32 CORBA::ORB_init (argc
, argv
);
34 if (parse_args (argc
, argv
) != 0)
37 CORBA::Object_var object
=
38 orb
->string_to_object (ior
);
40 Test::Roundtrip_var roundtrip
=
41 Test::Roundtrip::_narrow (object
.in ());
43 if (CORBA::is_nil (roundtrip
.in ()))
45 ACE_ERROR_RETURN ((LM_ERROR
,
46 "Nil Test::Roundtrip reference <%s>\n",
51 // Do a couple of calls on the server. If the sever is trying to
52 // do something stupid like sending an exception to us, then it
53 // won't be able to handle more than 1 request from us.
54 Test::Timestamp time
= 10;
55 for (int i
= 0; i
< num_calls
; i
++)
57 roundtrip
->test_method (time
);
59 ACE_DEBUG ((LM_DEBUG
, "Sent call # %d\n", i
));
62 // The following sleep is a workaround for a defect in the Windows
63 // implementation of sockets (Win XP)
64 // When this client exits after writing to a localhost socket
65 // Windows discards any data that has not been read by the server.
66 // The sleep gives the server time to catch up. num_calls/2 gives
67 // it half a second per request which *really* should be overkill, but
68 // it also means the client will terminate before the server actually
69 // handles the requests (a good thing).
70 // I'm still trying to decide whether this should be a bugzilla entry.
72 ACE_OS::sleep(num_calls
/2);
74 catch (const CORBA::Exception
& ex
)
76 ex
._tao_print_exception ("");