1
// SOCK_SEQPACK_Association_Test.cpp,v 1.2 2003/11/01 11:15:24 dhinton Exp
3
// ============================================================================
9
// SOCK_SEQPACK_Association_Test.cpp
13
// Tests the methods get_local_addrs and get_remote_addrs of class
14
// ACE_SOCK_SEQPACK_Association.
16
// This is not an automated "one-button" test. Rather, it prints
17
// some output to a log file, so that an interested human can
18
// inspect the output and get a vague notion of whether or not
19
// the methods are working properly.
22
// Edward Mulholland (emulholl@atl.lmco.com)
24
// ============================================================================
26
#include "ace/SOCK_SEQPACK_Association.h"
27
#include "ace/SOCK_SEQPACK_Connector.h"
28
#include "ace/INET_Addr.h"
29
#include "ace/Log_Msg.h"
31
void dump_names(const ACE_SOCK_SEQPACK_Association& assoc);
33
int main (int argc, ACE_TCHAR *argv[])
35
int status = 0; // Innocent until proven guilty
37
// object that manages the connection to the server
38
ACE_SOCK_SEQPACK_Connector connector;
40
// object that manages the data xfer between the client and server
41
ACE_SOCK_SEQPACK_Association dataStream;
43
// object that represents the server's IP address and port
44
ACE_INET_Addr serverAddr;
49
ACE_TEXT ("Usage: SOCK_SEQPACK_Association_Test hostname:port\n")));
52
} else if (serverAddr.set(argv[1])) {
56
ACE_TEXT ("ACE_INET_Addr::set")));
59
} else if (connector.connect (dataStream, serverAddr)) {
63
ACE_TEXT ("ACE_SOCK_SEQPACK_Connector::connect")));
69
ACE_TEXT ("Connected to server at %s\n"),
72
dump_names(dataStream);
80
void dump_names(const ACE_SOCK_SEQPACK_Association& assoc)
82
// Pre-declare for-loop index
85
size_t in_out_size = 100;
86
ACE_INET_Addr in_out[100];
89
const size_t outbuf_size = 1024;
90
ACE_TCHAR outbuf[outbuf_size];
92
// Get local addresses of the association
93
if (assoc.get_local_addrs(in_out, in_out_size)) {
101
ACE_DEBUG((LM_DEBUG, "Called get_local_addrs\n"));
103
// Print individual results of get_local_addrs
104
for (i = 0; i < in_out_size; ++i) {
106
if (in_out[i].addr_to_string(outbuf, outbuf_size)) {
115
"get_local_addrs[%i] = %s\n",
123
// Get remote addresses of the association
124
if (assoc.get_remote_addrs(in_out, in_out_size)) {
128
"get_remote_addrs"));
132
ACE_DEBUG((LM_DEBUG, "Called get_remote_addrs\n"));
134
// Print individual results of get_remote_addrs
135
for (i = 0; i < in_out_size; ++i) {
137
if (in_out[i].addr_to_string(outbuf, outbuf_size)) {
146
"get_remote_addrs[%i] = %s\n",