summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Huston <shuston@riverace.com>2007-08-29 18:54:22 +0000
committerSteve Huston <shuston@riverace.com>2007-08-29 18:54:22 +0000
commit646a35aedfb44c51b671099e2d1c8b9b0c40ceca (patch)
treee3a814b001e393a918537e174fc2c91fa386b796
parentb53feb0d8f6be8a65362780c40cf6844d1a2c6af (diff)
downloadATCD-646a35aedfb44c51b671099e2d1c8b9b0c40ceca.tar.gz
ChangeLogTag:Wed Aug 29 18:55:33 UTC 2007 Steve Huston <shuston@riverace.com>
-rw-r--r--ACE/ChangeLog7
-rw-r--r--ACE/protocols/tests/HTBP/ping/client.cpp98
2 files changed, 60 insertions, 45 deletions
diff --git a/ACE/ChangeLog b/ACE/ChangeLog
index bcd4c8d6280..2a7192c21ab 100644
--- a/ACE/ChangeLog
+++ b/ACE/ChangeLog
@@ -1,3 +1,10 @@
+Wed Aug 29 18:55:33 UTC 2007 Steve Huston <shuston@riverace.com>
+
+ * protocols/tests/HTBP/ping/client.cpp: Explicitly set AF_INET on the
+ address to connect to the server on. Fixes fails on IPv6 builds.
+ Thanks to Phil Mesnier for diagnosing this problem.
+ Also fixed logging conversions where needed for 64-bit and wide-char.
+
Wed Aug 29 18:21:12 UTC 2007 Johnny Willemsen <jwillemsen@remedy.nl>
* include/makeinclude/platform_aix_g++.GNU:
diff --git a/ACE/protocols/tests/HTBP/ping/client.cpp b/ACE/protocols/tests/HTBP/ping/client.cpp
index e34b98a83fc..0f3e351685a 100644
--- a/ACE/protocols/tests/HTBP/ping/client.cpp
+++ b/ACE/protocols/tests/HTBP/ping/client.cpp
@@ -1,10 +1,10 @@
/**
- * client for a basic connection establishment test using HTBP
- *
* $Id$
+ *
+ * client for a basic connection establishment test using HTBP
*/
-
+#include "ace/ACE.h"
#include "ace/Log_Msg.h"
#include "ace/Get_Opt.h"
@@ -16,12 +16,12 @@
const ACE_TCHAR * remote_host = 0;
const ACE_TCHAR * config_file = 0;
-unsigned remote_port = 8088;
+unsigned int remote_port = 8088;
int
parse_args (int argc, ACE_TCHAR *argv[])
{
- ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("p:h:c:"));
+ ACE_Get_Opt get_opts (argc, argv, ACE_TEXT ("p:h:c:d"));
int c;
while ((c = get_opts ()) != -1)
@@ -36,6 +36,9 @@ parse_args (int argc, ACE_TCHAR *argv[])
case 'c':
config_file = get_opts.opt_arg ();
break;
+ case 'd':
+ ACE::debug (true);
+ break;
case '?':
default:
ACE_ERROR_RETURN ((LM_ERROR,
@@ -43,6 +46,7 @@ parse_args (int argc, ACE_TCHAR *argv[])
ACE_TEXT ("-h remote_host ")
ACE_TEXT ("-p remote_port ")
ACE_TEXT ("-c config_file ")
+ ACE_TEXT ("-d (turn on extra logging)")
ACE_TEXT ("\n"),
argv [0]),
-1);
@@ -52,28 +56,29 @@ parse_args (int argc, ACE_TCHAR *argv[])
}
int
-ACE_TMAIN(int argc, ACE_TCHAR *argv[])
+ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
ACE_OS::socket_init (ACE_WSOCK_VERSION);
- if (parse_args(argc, argv) != 0)
+ if (parse_args (argc, argv) != 0)
return 1;
if (remote_host == 0)
ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("Client: No remote host specified\n")),1);
+ ACE_TEXT ("Client: No remote host specified\n")),
+ 1);
ACE::HTBP::Environment env;
if (config_file != 0)
env.import_config (config_file);
ACE::HTBP::ID_Requestor req (&env);
- ACE::HTBP::Addr local(ACE_TEXT_ALWAYS_CHAR(req.get_HTID()));
+ ACE::HTBP::Addr local (ACE_TEXT_ALWAYS_CHAR (req.get_HTID ()));
- unsigned proxy_port = 0;
+ unsigned int proxy_port = 0;
ACE_TString proxy_host;
- if (env.get_proxy_port(proxy_port) != 0 ||
- env.get_proxy_host(proxy_host) != 0)
+ if (env.get_proxy_port (proxy_port) != 0 ||
+ env.get_proxy_host (proxy_host) != 0)
{
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%P|%t) Client: ")
@@ -83,15 +88,15 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[])
proxy_host = remote_host;
}
- ACE_INET_Addr proxy(proxy_port,proxy_host.c_str());
- ACE::HTBP::Addr remote (remote_port,ACE_TEXT_ALWAYS_CHAR(remote_host));
+ ACE_INET_Addr proxy (proxy_port, proxy_host.c_str (), AF_INET);
+ ACE::HTBP::Addr remote (remote_port, ACE_TEXT_ALWAYS_CHAR (remote_host));
ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT("(%P|%t) Client: connecting to port %d\n"),
+ ACE_TEXT ("(%P|%t) Client: connecting to port %u\n"),
proxy_port));
- ACE::HTBP::Session session(remote,
- local,
- ACE::HTBP::Session::next_session_id(),
- &proxy);
+ ACE::HTBP::Session session (remote,
+ local,
+ ACE::HTBP::Session::next_session_id (),
+ &proxy);
ACE::HTBP::Stream stream (&session);
char buffer[1000];
@@ -99,25 +104,27 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[])
int retrycount = 10;
for (int i = 0; i < 3; i++)
{
- ACE_OS::sprintf (buffer,"Do you hear me? %d",i);
- ACE::HTBP::Channel *ob = session.outbound();
- n = stream.send (buffer,ACE_OS::strlen(buffer)+1);
+ ACE_OS::sprintf (buffer, "Do you hear me? %d", i);
+ ACE::HTBP::Channel *ob = session.outbound ();
+ n = stream.send (buffer, ACE_OS::strlen (buffer)+1);
if (n == -1)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("(%P|%t) Client: ")
ACE_TEXT ("%p\n"),
- ACE_TEXT("stream send")),-1);
+ ACE_TEXT("stream send")),
+ -1);
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%P|%t) Client: ")
- ACE_TEXT ("send returned %d\n"),n));
+ ACE_TEXT ("send returned %b\n"),
+ n));
retrycount = 10;
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%P|%t) Client: ")
- ACE_TEXT ("after send, outbound = %x, ob = %x\n"),
- session.outbound(), ob));
- while ((n = ob->recv_ack()) == -1
+ ACE_TEXT ("after send, outbound = %@, ob = %@\n"),
+ session.outbound (), ob));
+ while ((n = ob->recv_ack ()) == -1
&& (errno == EWOULDBLOCK || errno == ETIME)
&& retrycount > 0)
{
@@ -130,11 +137,11 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[])
}
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%P|%t) Client: ")
- ACE_TEXT ("After wait for ack, n = %d, retry = %d\n"),
- n,retrycount,errno));
+ ACE_TEXT ("After wait for ack, n = %b, retry = %d\n"),
+ n, retrycount));
retrycount = 10;
- while ((n = stream.recv(buffer,1000)) == -1
+ while ((n = stream.recv (buffer, 1000)) == -1
&& (errno == EWOULDBLOCK || errno == ETIME)
&& retrycount > 0)
{
@@ -143,37 +150,38 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[])
ACE_TEXT ("(%P|%t) Client: ")
ACE_TEXT ("waiting for inbound data, %d tries left\n"),
retrycount));
- ACE_OS::sleep(1);
+ ACE_OS::sleep (1);
}
if (retrycount == 0 || n < 0)
{
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%P|%t) Client: ")
- ACE_TEXT ("bailing after wait, %p\n"),"recv"));
+ ACE_TEXT ("bailing after wait, %p\n"),
+ ACE_TEXT ("recv")));
break;
}
buffer[n] = 0;
-
ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("(%P|%t) Client: ")
- ACE_TEXT ("Got: \"%s\"\n"),buffer));
+ ACE_TEXT ("(%P|%t) Client: Got: \"%C\"\n"),
+ buffer));
}
- ACE::HTBP::Channel *ob = session.outbound();
- n = stream.send ("goodbye",7);
+ ACE::HTBP::Channel *ob = session.outbound ();
+ n = stream.send ("goodbye", 7);
if (n == -1)
ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("(%P|%t) Client: ")
- ACE_TEXT ("%p\n"),
- ACE_TEXT("stream send")),-1);
+ ACE_TEXT ("(%P|%t) Client: %p\n"),
+ ACE_TEXT ("stream send")),
+ -1);
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%P|%t) Client: ")
- ACE_TEXT ("send returned %d\n"),n));
+ ACE_TEXT ("send returned %b\n"),
+ n));
retrycount = 10;
- while ((n = ob->recv_ack()) == -1
+ while ((n = ob->recv_ack ()) == -1
&& (errno == EWOULDBLOCK || errno == ETIME)
&& retrycount > 0)
{
@@ -186,8 +194,8 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[])
}
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%P|%t) Client: ")
- ACE_TEXT ("After wait for ack, n = %d, retry = %d\n"),
- n,retrycount,errno));
- stream.close();
+ ACE_TEXT ("After wait for ack, n = %b, retry = %d\n"),
+ n, retrycount));
+ stream.close ();
return 0;
}