blob: 5ad03333a4973f303621127175bac2438f46b61b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
//$Id$
#include "Echo_Client_i.h"
#include "ace/Get_Opt.h"
#include "ace/Read_Buffer.h"
#include "ace/OS_NS_unistd.h"
// This is the interface program that accesses the remote object
// Constructor.
Echo_Client_i::Echo_Client_i (void)
{
//no-op
}
//Destructor.
Echo_Client_i::~Echo_Client_i (void)
{
//no-op
}
int
Echo_Client_i::run (const char *name,
int argc,
char *argv[])
{
// Initialize the client.
if (client.init (name,argc, argv) == -1)
return -1;
ACE_DECLARE_NEW_CORBA_ENV;
ACE_TRY
{
while (1)
{
char buf[BUFSIZ];
// Get the input message which has to be displayed.
ACE_DEBUG ((LM_DEBUG,
"ECHO? "));
if (ACE_OS::fgets (buf,sizeof buf, stdin) == 0)
break;
CORBA::String_var s = client->echo_string (buf
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
ACE_DEBUG ((LM_DEBUG,
"\nString echoed by client \n%s\n",
s.in ()));
}
if (client.shutdown () == 1)
client->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_TRY_CHECK;
}
ACE_CATCHANY
{
ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,"\n Exception in RMI");
return -1;
}
ACE_ENDTRY;
ACE_CHECK_RETURN (-1);
return 0;
}
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class Client<Echo,Echo_var>;
#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
#pragma instantiate Client<Echo,Echo_var>
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
|