diff options
author | Steve Huston <shuston@riverace.com> | 2007-08-30 00:15:46 +0000 |
---|---|---|
committer | Steve Huston <shuston@riverace.com> | 2007-08-30 00:15:46 +0000 |
commit | d906eabf79d7aabdcbc3bad453a4a40b1876abab (patch) | |
tree | 35926c6e613873fa15830f1e3805a9a53ddf7fe6 | |
parent | 50f8f37a822e89bb45c423d61c42fcd3aadc0308 (diff) | |
download | ATCD-d906eabf79d7aabdcbc3bad453a4a40b1876abab.tar.gz |
ChangeLogTag:Wed Aug 29 23:36:52 UTC 2007 Steve Huston <shuston@riverace.com>
-rw-r--r-- | ACE/ChangeLog | 11 | ||||
-rw-r--r-- | ACE/protocols/tests/HTBP/Reactor_Tests/client.cpp | 21 | ||||
-rw-r--r-- | ACE/protocols/tests/HTBP/Reactor_Tests/server.cpp | 20 | ||||
-rw-r--r-- | ACE/protocols/tests/HTBP/Send_Large_Msg/server.cpp | 20 | ||||
-rw-r--r-- | ACE/protocols/tests/HTBP/ping/server.cpp | 12 |
5 files changed, 67 insertions, 17 deletions
diff --git a/ACE/ChangeLog b/ACE/ChangeLog index ab37f8cf7c9..4217e63b81c 100644 --- a/ACE/ChangeLog +++ b/ACE/ChangeLog @@ -1,3 +1,14 @@ +Wed Aug 29 23:36:52 UTC 2007 Steve Huston <shuston@riverace.com> + + * protocols/tests/HTBP/Reactor_Tests/server.cpp: + * protocols/tests/HTBP/Send_Large_Msg/server.cpp: + * protocols/tests/HTBP/ping/server.cpp: + Listen at the IP address represented by the hostname, not "any". + Matches what the client is going to do when looking up the host + to connect to. Of particular interest is getting the IP address + families to be the same for server and client on IPv6-capable + systems. Thanks to Phil Mesnier for these patches. + Wed Aug 29 22:53:57 UTC 2007 Steve Huston <shuston@riverace.com> * bin/LabVIEW_RT: A directory of information and utilities useful diff --git a/ACE/protocols/tests/HTBP/Reactor_Tests/client.cpp b/ACE/protocols/tests/HTBP/Reactor_Tests/client.cpp index 56f5125f374..9d4dffe0ee9 100644 --- a/ACE/protocols/tests/HTBP/Reactor_Tests/client.cpp +++ b/ACE/protocols/tests/HTBP/Reactor_Tests/client.cpp @@ -67,7 +67,7 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) 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; ACE_TString proxy_host; @@ -83,10 +83,23 @@ 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 ()); + ACE::HTBP::Addr remote (remote_port, ACE_TEXT_ALWAYS_CHAR (remote_host)); - ACE::HTBP::Session session(remote,local,ACE::HTBP::Session::next_session_id(),&proxy); + ACE_TCHAR local_s[512], remote_s[512], proxy_s[512]; + remote.addr_to_string (remote_s, 512); + local.addr_to_string (local_s, 512); + proxy.addr_to_string (proxy_s, 512); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) Client starting session for ") + ACE_TEXT ("remote %s, local %s, proxy %s\n"), + remote_s, + local_s, + proxy_s)); + ACE::HTBP::Session session (remote, + local, + ACE::HTBP::Session::next_session_id(), + &proxy); ACE::HTBP::Stream stream (&session); char buffer[1000]; diff --git a/ACE/protocols/tests/HTBP/Reactor_Tests/server.cpp b/ACE/protocols/tests/HTBP/Reactor_Tests/server.cpp index 91cb0f2bdca..7bc3d8ac0ee 100644 --- a/ACE/protocols/tests/HTBP/Reactor_Tests/server.cpp +++ b/ACE/protocols/tests/HTBP/Reactor_Tests/server.cpp @@ -16,6 +16,7 @@ #include "ace/Reactor.h" #include "ace/Get_Opt.h" #include "ace/OS_NS_stdio.h" +#include "ace/OS_NS_unistd.h" unsigned port = 8088; const ACE_TCHAR *notifier_file = 0; @@ -179,7 +180,7 @@ Stream_Handler::handle_input (ACE_HANDLE h) buffer[n] = 0; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) Server Stream_Handler::handle_input ") - ACE_TEXT (" (%d) read %d:\n%C\n"), + ACE_TEXT (" (%d) read %b:\n%C\n"), h, n, buffer)); const char *tok_loc = ACE_OS::strstr (buffer, "goodbye"); @@ -210,15 +211,24 @@ ACE_TMAIN (int argc, ACE_TCHAR * argv[]) ACE_TEXT ("At start of main\n"))); ACE_OS::socket_init (ACE_WSOCK_VERSION); - if (parse_args(argc, argv) != 0) + if (parse_args (argc, argv) != 0) return 1; - ACE_INET_Addr local(port); + ACE_TCHAR host[MAXHOSTNAMELEN+1]; + if (ACE_OS::hostname (host, MAXHOSTNAMELEN) != 0) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("(%P|%t) Server failure: %p\n"), + ACE_TEXT ("hostname")), + 1); + + ACE_INET_Addr local (port, host); + local.addr_to_string (host, MAXHOSTNAMELEN); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) Server: ") - ACE_TEXT ("got address\n"))); + ACE_TEXT ("listening at %s\n"), + host)); - ACE_SOCK_Acceptor acc(local,1); + ACE_SOCK_Acceptor acc (local, 1); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) Server: ") ACE_TEXT ("opened listener\n"))); diff --git a/ACE/protocols/tests/HTBP/Send_Large_Msg/server.cpp b/ACE/protocols/tests/HTBP/Send_Large_Msg/server.cpp index e4f632af9ea..34f037148c5 100644 --- a/ACE/protocols/tests/HTBP/Send_Large_Msg/server.cpp +++ b/ACE/protocols/tests/HTBP/Send_Large_Msg/server.cpp @@ -52,10 +52,17 @@ 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; - ACE_INET_Addr local(port); + ACE_TCHAR host[MAXHOSTNAMELEN+1]; + if (ACE_OS::hostname (host,MAXHOSTNAMELEN) != 0) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("(%P|%t) Server failure: %p\n"), + ACE_TEXT ("hostname")), + 1); + + ACE_INET_Addr local (port, host); ACE_SOCK_Stream sock[2]; ACE::HTBP::Channel *channels[2]; ACE_SOCK_Acceptor acc(local,1); @@ -124,7 +131,7 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) got = stream.recv (buffer, sizeof (buffer)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT("(%P|%t) Server: ") - ACE_TEXT("got = %d\n"), got)); + ACE_TEXT("got = %b\n"), got)); if (got < 0) break; @@ -133,11 +140,11 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) ACE_DEBUG ((LM_DEBUG, ACE_TEXT("(%P|%t) Server: ") - ACE_TEXT("received %d \n"),total_recv)); + ACE_TEXT("received %b \n"),total_recv)); ACE_OS::strcpy (buffer,"I hear you !"); - ssize_t n = stream.send (buffer,ACE_OS::strlen(buffer)+1); + ssize_t n = stream.send (buffer, ACE_OS::strlen (buffer)+1); if (n == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT("(%P|%t) Server: ") @@ -146,7 +153,8 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) ACE_DEBUG ((LM_DEBUG, ACE_TEXT("(%P|%t) Server: ") - ACE_TEXT("send returned %d\n"),n)); + ACE_TEXT("send returned %b\n"), + n)); ACE_OS::sleep(1); // prevent test failure on windows when the connection // closes too fast. diff --git a/ACE/protocols/tests/HTBP/ping/server.cpp b/ACE/protocols/tests/HTBP/ping/server.cpp index 7a3cb2e75b8..26611489de6 100644 --- a/ACE/protocols/tests/HTBP/ping/server.cpp +++ b/ACE/protocols/tests/HTBP/ping/server.cpp @@ -55,11 +55,19 @@ ACE_TMAIN (int argc , ACE_TCHAR *argv[]) if (parse_args(argc, argv) != 0) return 1; - ACE_INET_Addr local(port); + ACE_TCHAR host[MAXHOSTNAMELEN+1]; + if (ACE_OS::hostname (host, MAXHOSTNAMELEN) != 0) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("(%P|%t) Server failure: %p\n"), + ACE_TEXT ("hostname")), + 1); + + ACE_INET_Addr local (port, host); ACE_SOCK_Stream sock[2]; ACE_SOCK_Acceptor acc(local,1); ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%P|%t) Server is ready on port %d\n"),port)); + ACE_TEXT ("(%P|%t) Server is ready on port %s:%d\n"), + host, port)); if (notifier_file != 0) { FILE *f = ACE_OS::fopen (notifier_file,ACE_TEXT("w+")); |