blob: 5ea95176562e1fa3f42e3d0ffdedd54b90a104fb (
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
|
// $Id$
#include "tao/Strategies/advanced_resource.h"
// Stock Quoter Stub
#include "Stock_QuoterC.h"
#include "UDPTestC.h"
#include "ace/streams.h"
unsigned char Msg[1000] = { 0 } ;
int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
try
{
// Initialize the ORB
CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
// Use a simple ObjectKey to access the Stock Quoter.
// (Client ORB must be initialized with
// -ORBInitRef MyStockQuoter=corbaloc:...)
CORBA::Object_var udp_obj =
orb->resolve_initial_references ("UDPTest");
CORBA::Object_var stock_quoter_obj =
orb->resolve_initial_references ("MyStockQuoter");
UDPTestI_var server = UDPTestI::_narrow (udp_obj.in ());
Stock_Quoter_var quoter = Stock_Quoter::_narrow (stock_quoter_obj.in());
memset( Msg, 1, 1000 ) ;
//UDP->send( 10 ) ;
server->send( Msg ) ;
try
{
CORBA::Float current_stock_price = quoter->get_quote ("BA");
cout << "Stock Id: BA, Price = " << current_stock_price << endl;
}
catch (Bad_Ticker_Symbol& e)
{
cerr << "Caught a bad ticker symbol exception: "
<< e.symbol << endl;;
}
quoter->shutdown ();
orb->destroy ();
}
catch (CORBA::Exception& e)
{
e._tao_print_exception ("Exception caught:");
return 1;
}
return 0;
}
|