Changes to attempt to silence bcc64x
[ACE_TAO.git] / ACE / performance-tests / SCTP / SOCK_SEQPACK_Association_Test.cpp
blobc677a757f0f260ba9660888c7c15fdabdd328146
2 //=============================================================================
3 /**
4 * @file SOCK_SEQPACK_Association_Test.cpp
6 * Tests the methods get_local_addrs and get_remote_addrs of class
7 * ACE_SOCK_SEQPACK_Association.
9 * This is not an automated "one-button" test. Rather, it prints
10 * some output to a log file, so that an interested human can
11 * inspect the output and get a vague notion of whether or not
12 * the methods are working properly.
14 * @author Edward Mulholland (emulholl@atl.lmco.com)
16 //=============================================================================
19 #include "ace/SOCK_SEQPACK_Association.h"
20 #include "ace/SOCK_SEQPACK_Connector.h"
21 #include "ace/INET_Addr.h"
22 #include "ace/Log_Msg.h"
24 void dump_names(const ACE_SOCK_SEQPACK_Association& assoc);
26 int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
28 int status = 0; // Innocent until proven guilty
30 // object that manages the connection to the server
31 ACE_SOCK_SEQPACK_Connector connector;
33 // object that manages the data xfer between the client and server
34 ACE_SOCK_SEQPACK_Association dataStream;
36 // object that represents the server's IP address and port
37 ACE_INET_Addr serverAddr;
39 if (argc < 2) {
40 ACE_ERROR ((LM_ERROR,
41 ACE_TEXT ("Usage: SOCK_SEQPACK_Association_Test hostname:port\n")));
42 status = 1;
43 } else if (serverAddr.set(argv[1])) {
44 ACE_ERROR ((LM_ERROR,
45 ACE_TEXT ("%p\n"),
46 ACE_TEXT ("ACE_INET_Addr::set")));
47 status = 1;
48 } else if (connector.connect (dataStream, serverAddr)) {
49 ACE_ERROR ((LM_ERROR,
50 ACE_TEXT ("%p\n"),
51 ACE_TEXT ("ACE_SOCK_SEQPACK_Connector::connect")));
52 status = 1;
53 } else {
54 ACE_DEBUG ((LM_DEBUG,
55 ACE_TEXT ("Connected to server at %s\n"),
56 argv[1]));
58 dump_names(dataStream);
61 dataStream.close();
63 return status;
66 void dump_names(const ACE_SOCK_SEQPACK_Association& assoc)
68 // Pre-declare for-loop index
69 size_t i = 0;
71 size_t in_out_size = 100;
72 ACE_INET_Addr in_out[100];
74 // Output char buffer
75 const size_t outbuf_size = 1024;
76 ACE_TCHAR outbuf[outbuf_size];
78 // Get local addresses of the association
79 if (assoc.get_local_addrs(in_out, in_out_size)) {
80 ACE_ERROR((LM_ERROR,
81 "%p\n",
82 "get_local_addrs"));
83 return;
86 ACE_DEBUG((LM_DEBUG, "Called get_local_addrs\n"));
88 // Print individual results of get_local_addrs
89 for (i = 0; i < in_out_size; ++i) {
90 if (in_out[i].addr_to_string(outbuf, outbuf_size)) {
91 ACE_ERROR((LM_ERROR,
92 "%p\n",
93 "addr_to_string"));
94 return;
97 ACE_DEBUG((LM_DEBUG,
98 "get_local_addrs[%i] = %s\n",
100 outbuf));
103 // Reset in_out_size
104 in_out_size = 100;
106 // Get remote addresses of the association
107 if (assoc.get_remote_addrs(in_out, in_out_size)) {
108 ACE_ERROR((LM_ERROR,
109 "%p\n",
110 "get_remote_addrs"));
111 return;
114 ACE_DEBUG((LM_DEBUG, "Called get_remote_addrs\n"));
116 // Print individual results of get_remote_addrs
117 for (i = 0; i < in_out_size; ++i) {
118 if (in_out[i].addr_to_string(outbuf, outbuf_size)) {
119 ACE_ERROR((LM_ERROR,
120 "%p\n",
121 "addr_to_string"));
122 return;
125 ACE_DEBUG((LM_DEBUG,
126 "get_remote_addrs[%i] = %s\n",
128 outbuf));