diff options
author | nobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-04-10 19:59:37 +0000 |
---|---|---|
committer | nobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-04-10 19:59:37 +0000 |
commit | 3df4acfa816441fc28a95dee6d0191a927145d95 (patch) | |
tree | b5ae7ca44662cfd8e5c95f1826e4406021a606f5 /examples/IPC_SAP/SOCK_SAP/CPP-memserver.cpp | |
parent | 60a5612b83d856fc0adc52b9f39fac9960ec9818 (diff) | |
download | ATCD-pre-subset.tar.gz |
This commit was manufactured by cvs2svn to create tag 'pre-subset'.pre-subset
Diffstat (limited to 'examples/IPC_SAP/SOCK_SAP/CPP-memserver.cpp')
-rw-r--r-- | examples/IPC_SAP/SOCK_SAP/CPP-memserver.cpp | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/examples/IPC_SAP/SOCK_SAP/CPP-memserver.cpp b/examples/IPC_SAP/SOCK_SAP/CPP-memserver.cpp deleted file mode 100644 index 40f228c89da..00000000000 --- a/examples/IPC_SAP/SOCK_SAP/CPP-memserver.cpp +++ /dev/null @@ -1,70 +0,0 @@ -// $Id$ - -// This example tests the features of the <ACE_MEM_Acceptor>, -// <ACE_MEM_Stream>, and <ACE_Svc_Handler> classes. If the platform -// supports threads it uses a thread-per-connection concurrency model. -// Otherwise, it uses a single-threaded iterative server model. - -#include "ace/MEM_Acceptor.h" -#include "ace/Thread_Manager.h" -#include "ace/Handle_Set.h" -#include "ace/Profile_Timer.h" - -ACE_RCSID(SOCK_SAP, CPP_inserver, "$Id$") - -static int -run_event_loop (u_short port) -{ - // Create the acceptors. - ACE_MEM_Acceptor acceptor; - - ACE_MEM_Addr server_addr (port); - - // Create acceptors, reuse the address. - if (acceptor.open (server_addr, 1) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "open"), - 1); - else if (acceptor.get_local_addr (server_addr) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "get_local_addr"), - 1); - - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) starting server at port %d\n", - server_addr.get_port_number ())); - - // Keep these objects out here to prevent excessive constructor - // calls within the loop. - ACE_MEM_Stream new_stream; - - // blocking wait on accept. - if (acceptor.accept (new_stream) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "accept"), - -1); - - char buf[MAXPATHLEN]; - int len = 0; - while ((len = new_stream.recv (buf, MAXPATHLEN)) != -1) - { - ACE_DEBUG ((LM_DEBUG, "%s\n", buf)); - new_stream.send (buf, len); - } - - return new_stream.fini (); -} - -int -main (int argc, char *argv[]) -{ - u_short port = ACE_DEFAULT_SERVER_PORT; - - if (argc > 1) - port = ACE_OS::atoi (argv[1]); - - return run_event_loop (port); -} |