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 | 57cc53c4ff637a21ad2ce22e142d2e601bda5c86 (patch) | |
tree | 35926c6e613873fa15830f1e3805a9a53ddf7fe6 /ACE/protocols | |
parent | d8a67ed5134ecedb15aca8e04bcc1e805ab21285 (diff) | |
download | ATCD-57cc53c4ff637a21ad2ce22e142d2e601bda5c86.tar.gz |
ChangeLogTag:Wed Aug 29 23:36:52 UTC 2007 Steve Huston <shuston@riverace.com>
Diffstat (limited to 'ACE/protocols')
-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 |
4 files changed, 56 insertions, 17 deletions
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+")); |