diff options
author | joeh <joeh@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-04-07 17:42:34 +0000 |
---|---|---|
committer | joeh <joeh@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-04-07 17:42:34 +0000 |
commit | ea39f4d68b165547a854a75c9aeab2316cffaf26 (patch) | |
tree | 3789bee75dc57bbb420e8927cf231e343de13e50 | |
parent | bd0f8e511f96f12f3963ec6aee77a28b6fc2da40 (diff) | |
download | ATCD-ea39f4d68b165547a854a75c9aeab2316cffaf26.tar.gz |
.
-rw-r--r-- | examples/IPC_SAP/TLI_SAP/CPP-client.cpp | 57 | ||||
-rw-r--r-- | examples/IPC_SAP/TLI_SAP/CPP-server.cpp | 15 |
2 files changed, 4 insertions, 68 deletions
diff --git a/examples/IPC_SAP/TLI_SAP/CPP-client.cpp b/examples/IPC_SAP/TLI_SAP/CPP-client.cpp index f7dc939527c..c02f576b701 100644 --- a/examples/IPC_SAP/TLI_SAP/CPP-client.cpp +++ b/examples/IPC_SAP/TLI_SAP/CPP-client.cpp @@ -1,7 +1,6 @@ // $Id$ #include "ace/TLI_Connector.h" -#include "ace/ATM_Addr.h" #include "ace/INET_Addr.h" ACE_RCSID(TLI_SAP, CPP_client, "$Id$") @@ -12,44 +11,17 @@ ACE_RCSID(TLI_SAP, CPP_client, "$Id$") int main (int argc, char *argv[]) { -#if defined (ACE_HAS_FORE_ATM_XTI) - if (argc < 2) - ACE_ERROR_RETURN ((LM_ERROR, - "Usage: %s hostname [QoS in KB/sec] [timeout]\n", - argv[0]), - 1); - const char *host = argv[1]; - int qos = argc > 2 ? ACE_OS::atoi (argv[2]) : 0; - int timeout = argc > 3 ? ACE_OS::atoi (argv[3]) : ACE_DEFAULT_TIMEOUT; -#else const char *host = argc > 1 ? argv[1] : ACE_DEFAULT_SERVER_HOST; u_short r_port = argc > 2 ? ACE_OS::atoi (argv[2]) : ACE_DEFAULT_SERVER_PORT; int timeout = argc > 3 ? ACE_OS::atoi (argv[3]) : ACE_DEFAULT_TIMEOUT; u_short l_port = argc > 4 ? ACE_OS::atoi (argv[4]) : ACE_DEFAULT_LOCAL_PORT; -#endif /* ACE_HAS_FORE_ATM_XTI */ char buf[BUFSIZ]; ACE_TLI_Stream cli_stream; -#if defined (ACE_HAS_FORE_ATM_XTI) - ACE_ATM_Addr remote_addr (host); - char hostname[MAXNAMELEN]; - ACE_OS::hostname(hostname, MAXNAMELEN); - ACE_ATM_Addr local_addr (hostname); - - // In order to construct connections options the file handle is - // needed. Therefore, we need to open the TLI_Stream before we - // construct the options. - if (cli_stream.open (ACE_TLI_TCP_DEVICE, O_RDWR, 0) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "open failed"), - 1); -#else ACE_INET_Addr remote_addr (r_port, host); ACE_INET_Addr local_addr (l_port); -#endif /* ACE_HAS_FORE_ATM_XTI */ ACE_DEBUG ((LM_DEBUG, "starting non-blocking connect\n")); @@ -57,38 +29,11 @@ int main (int argc, char *argv[]) // Initiate timed, non-blocking connection with server. ACE_TLI_Connector con; -#if defined (ACE_HAS_FORE_ATM_XTI) - // Construct QoS options - currently FORE only supports bandwidth - long optlen = 0; - char *options = ACE_ATM_Addr::construct_options (cli_stream.get_handle (), - qos, - ACE_ATM_Addr::OPT_FLAGS_CPID, - &optlen); - struct netbuf optbuf; - optbuf.len = optlen; - optbuf.buf = options; - - // Not sure why but reuse_addr set to true/1 causes problems for - // FORE/XTI/ATM - this is now handled in - // ACE_TLI_Connector::connect() - if (con.connect (cli_stream, remote_addr, - (ACE_Time_Value *) &ACE_Time_Value::zero, - local_addr, - 1, - O_RDWR, - 0, - ACE_TLI_TCP_DEVICE, - 0, - 1, - 0, - &optbuf) == -1) -#else if (con.connect (cli_stream, remote_addr, (ACE_Time_Value *) &ACE_Time_Value::zero, local_addr, 1) == -1) -#endif /* ACE_HAS_FORE_ATM_XTI */ { if (errno != EWOULDBLOCK) ACE_ERROR_RETURN ((LM_ERROR, @@ -113,7 +58,7 @@ int main (int argc, char *argv[]) else ACE_DEBUG ((LM_DEBUG, "connected to %s\n", - remote_addr.addr_to_string ())); + remote_addr.get_host_name ())); } // Send data to server (correctly handles "incomplete writes"). diff --git a/examples/IPC_SAP/TLI_SAP/CPP-server.cpp b/examples/IPC_SAP/TLI_SAP/CPP-server.cpp index dd610da56c5..2cc3204a9a3 100644 --- a/examples/IPC_SAP/TLI_SAP/CPP-server.cpp +++ b/examples/IPC_SAP/TLI_SAP/CPP-server.cpp @@ -1,7 +1,6 @@ // $Id$ #include "ace/TLI_Acceptor.h" -#include "ace/ATM_Addr.h" ACE_RCSID(TLI_SAP, CPP_server, "$Id$") @@ -11,19 +10,11 @@ ACE_RCSID(TLI_SAP, CPP_server, "$Id$") int main (int argc, char *argv[]) { -#if defined (ACE_HAS_FORE_ATM_XTI) - ACE_Time_Value timeout (argc > 1 ? ACE_OS::atoi (argv[2]) : ACE_DEFAULT_TIMEOUT); -#else u_short port = argc > 1 ? ACE_OS::atoi (argv[1]) : ACE_DEFAULT_SERVER_PORT; ACE_Time_Value timeout (argc > 2 ? ACE_OS::atoi (argv[2]) : ACE_DEFAULT_TIMEOUT); -#endif /* ACE_HAS_FORE_ATM_XTI */ // Create a server address. -#if defined (ACE_HAS_FORE_ATM_XTI) - ACE_ATM_Addr addr; -#else ACE_INET_Addr addr (port); -#endif /* ACE_HAS_FORE_ATM_XTI */ // Create a server, reuse the addr. ACE_TLI_Acceptor peer_acceptor; @@ -39,8 +30,8 @@ main (int argc, char *argv[]) ACE_TLI_Stream new_stream; ACE_DEBUG ((LM_DEBUG, - "starting server at address %s\n", - addr.addr_to_string ())); + "starting server at host %s\n", + addr.get_host_name ())); // Performs the iterative server activities @@ -62,7 +53,7 @@ main (int argc, char *argv[]) ACE_DEBUG ((LM_DEBUG, "client %s connected\n", - addr.addr_to_string ())); + addr.get_host_name ())); // Read data from client (terminate on error). |