diff options
Diffstat (limited to 'examples/IPC_SAP/SOCK_SAP')
-rw-r--r-- | examples/IPC_SAP/SOCK_SAP/C-inclient.cpp | 60 | ||||
-rw-r--r-- | examples/IPC_SAP/SOCK_SAP/C-inserver.cpp | 84 | ||||
-rw-r--r-- | examples/IPC_SAP/SOCK_SAP/CPP-inclient.cpp | 86 | ||||
-rw-r--r-- | examples/IPC_SAP/SOCK_SAP/CPP-inserver-poll.cpp | 101 | ||||
-rw-r--r-- | examples/IPC_SAP/SOCK_SAP/CPP-inserver.cpp | 150 | ||||
-rw-r--r-- | examples/IPC_SAP/SOCK_SAP/CPP-unclient.cpp | 50 | ||||
-rw-r--r-- | examples/IPC_SAP/SOCK_SAP/CPP-unserver.cpp | 78 | ||||
-rw-r--r-- | examples/IPC_SAP/SOCK_SAP/FD-unclient.cpp | 50 | ||||
-rw-r--r-- | examples/IPC_SAP/SOCK_SAP/FD-unserver.cpp | 61 | ||||
-rw-r--r-- | examples/IPC_SAP/SOCK_SAP/Makefile | 267 | ||||
-rw-r--r-- | examples/IPC_SAP/SOCK_SAP/README | 38 | ||||
-rw-r--r-- | examples/IPC_SAP/SOCK_SAP/local_data | 1 |
12 files changed, 0 insertions, 1026 deletions
diff --git a/examples/IPC_SAP/SOCK_SAP/C-inclient.cpp b/examples/IPC_SAP/SOCK_SAP/C-inclient.cpp deleted file mode 100644 index 049bd51d1e6..00000000000 --- a/examples/IPC_SAP/SOCK_SAP/C-inclient.cpp +++ /dev/null @@ -1,60 +0,0 @@ -#include "ace/OS.h" -// $Id$ - - -/* BSD socket client */ - -int -main (int argc, char *argv[]) -{ - // Initialize WinSock DLL on Win32... - ACE_OS::socket_init (ACE_WSOCK_VERSION); - - struct sockaddr_in saddr; - struct hostent *hp; - char *host = argc > 1 ? argv[1] : ACE_DEFAULT_SERVER_HOST; - u_short port_num = - htons (argc > 2 ? atoi (argv[2]) : ACE_DEFAULT_SERVER_PORT); - char buf[BUFSIZ]; - ACE_HANDLE s_handle; - int w_bytes; - int r_bytes; - int n; - - // Create a local endpoint of communication. - if ((s_handle = ACE_OS::socket (PF_INET, SOCK_STREAM, 0)) == ACE_INVALID_HANDLE) - ACE_OS::perror ("socket"), ACE_OS::exit (1); - - // Determine IP address of the server. - if ((hp = ACE_OS::gethostbyname (host)) == 0) - ACE_OS::perror ("gethostbyname"), ACE_OS::exit (1); - - // Set up the address information to contact the server. - ACE_OS::memset ((void *) &saddr, 0, sizeof saddr); - saddr.sin_family = AF_INET; - saddr.sin_port = port_num; - ACE_OS::memcpy (&saddr.sin_addr, hp->h_addr, hp->h_length); - - // Establish connection with remote server. - if (ACE_OS::connect (s_handle, (struct sockaddr *) &saddr, - sizeof saddr) == -1) - ACE_OS::perror ("connect"), ACE_OS::exit (1); - - // Send data to server (correctly handles "incomplete writes" due to - // flow control). - - while ((r_bytes = ACE_OS::read (ACE_STDIN, buf, sizeof buf)) > 0) - for (w_bytes = 0; w_bytes < r_bytes; w_bytes += n) - if ((n = ACE_OS::send (s_handle, buf + w_bytes, - r_bytes - w_bytes)) < 0) - ACE_OS::perror ("write"), ACE_OS::exit (1); - - if (ACE_OS::recv (s_handle, buf, 1) == 1) - ACE_OS::write (ACE_STDOUT, buf, 1); - - // Explicitly close the connection. - if (ACE_OS::closesocket (s_handle) == -1) - ACE_OS::perror ("close"), ACE_OS::exit (1); - - return 0; -} diff --git a/examples/IPC_SAP/SOCK_SAP/C-inserver.cpp b/examples/IPC_SAP/SOCK_SAP/C-inserver.cpp deleted file mode 100644 index e2a0c0cca94..00000000000 --- a/examples/IPC_SAP/SOCK_SAP/C-inserver.cpp +++ /dev/null @@ -1,84 +0,0 @@ -#include "ace/OS.h" -// $Id$ - - -/* BSD socket server. */ - -int main (int argc, char *argv[]) -{ - // Initialize WinSock DLL on Win32... - ACE_OS::socket_init (ACE_WSOCK_VERSION); - - u_short port_num = - htons (argc > 1 ? ACE_OS::atoi (argv[1]) : ACE_DEFAULT_SERVER_PORT); - struct sockaddr_in saddr; - ACE_HANDLE s_handle, n_handle; - - /* Create a local endpoint of communication */ - if ((s_handle = ACE_OS::socket (PF_INET, SOCK_STREAM, 0)) == ACE_INVALID_HANDLE) - ACE_OS::perror ("socket"), ACE_OS::exit (1); - - /* Set up the address information to become a server */ - ACE_OS::memset ((void *) &saddr, 0, sizeof saddr); - saddr.sin_family = AF_INET; - saddr.sin_port = port_num; - saddr.sin_addr.s_addr = INADDR_ANY; - - /* Associate address with endpoint */ - if (ACE_OS::bind (s_handle, (struct sockaddr *) &saddr, - sizeof saddr) == -1) - ACE_OS::perror ("bind"), ACE_OS::exit (1); - - /* Make endpoint listen for service requests */ - if (ACE_OS::listen (s_handle, 5) == -1) - ACE_OS::perror ("listen"), ACE_OS::exit (1); - - /* Performs the iterative server activities */ - - for (;;) - { - char buf[BUFSIZ]; - int r_bytes; - struct sockaddr_in cli_addr; - int cli_addr_len = sizeof cli_addr; - struct hostent *hp; - - /* Create a new endpoint of communication */ - do - n_handle = ACE_OS::accept (s_handle, (struct sockaddr *) - &cli_addr, &cli_addr_len); - while (n_handle == ACE_INVALID_HANDLE && errno == EINTR); - - if (n_handle == ACE_INVALID_HANDLE) - { - ACE_OS::perror ("accept"); - continue; - } - - int addr_len = sizeof cli_addr.sin_addr.s_addr; - hp = ACE_OS::gethostbyaddr ((char *) &cli_addr.sin_addr, - addr_len, AF_INET); - - if (hp != 0) - ACE_OS::printf ("client %s\n", hp->h_name), ACE_OS::fflush (stdout); - else - ACE_OS::perror ("gethostbyaddr"); - - /* Read data from client (terminate on error) */ - - while ((r_bytes = ACE_OS::recv (n_handle, buf, sizeof buf)) > 0) - if (ACE_OS::write (ACE_STDOUT, buf, r_bytes) != r_bytes) - ACE_OS::perror ("write"), ACE_OS::exit (1); - - if (ACE_OS::send (n_handle, "", 1) != 1) - ::perror ("write"), ACE_OS::exit (1); - - /* Close the new endpoint - (listening endpoint remains open) */ - if (ACE_OS::closesocket (n_handle) == -1) - ACE_OS::perror ("close"), ACE_OS::exit (1); - ACE_OS::exit (0); - } - /* NOTREACHED */ - return 0; -} diff --git a/examples/IPC_SAP/SOCK_SAP/CPP-inclient.cpp b/examples/IPC_SAP/SOCK_SAP/CPP-inclient.cpp deleted file mode 100644 index de2d0b1f6cb..00000000000 --- a/examples/IPC_SAP/SOCK_SAP/CPP-inclient.cpp +++ /dev/null @@ -1,86 +0,0 @@ -// $Id$ - -// This tests the non-blocking features of the ACE_SOCK_Connector -// class. - -#include "ace/SOCK_Connector.h" -#include "ace/INET_Addr.h" - -// ACE SOCK_SAP client. - -int main (int argc, char *argv[]) -{ - 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; - ACE_Time_Value timeout (argc > 3 ? ACE_OS::atoi (argv[3]) : ACE_DEFAULT_TIMEOUT); - char buf[BUFSIZ]; - - ACE_SOCK_Stream cli_stream; - ACE_INET_Addr remote_addr (r_port, host); - - ACE_SOCK_Connector con; - - // Attempt a non-blocking connect to the server, reusing the local - // addr if necessary. -#if defined (VXWORKS) - // Initiate blocking connection with server. - ACE_DEBUG ((LM_DEBUG, "starting connect\n")); - - if (con.connect (cli_stream, remote_addr) == -1) -#else - // Initiate timed, non-blocking connection with server. - ACE_DEBUG ((LM_DEBUG, "starting non-blocking connect\n")); - - if (con.connect (cli_stream, remote_addr, (ACE_Time_Value *) &ACE_Time_Value::zero) == -1) -#endif /* VXWORKS */ - { - if (errno != EWOULDBLOCK) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "connection failed"), 1); - - ACE_DEBUG ((LM_DEBUG, "starting timed connect\n")); - -#if !defined (VXWORKS) - // Check if non-blocking connection is in progress, - // and wait up to timeout seconds for it to complete. - - if (con.complete (cli_stream, &remote_addr, &timeout) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "complete failed"), 1); - else - ACE_DEBUG ((LM_DEBUG, "connected to %s\n", remote_addr.get_host_name ())); -#endif /* !VXWORKS */ - } - -#if !defined (VXWORKS) - if (cli_stream.disable (ACE_NONBLOCK) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "disable"), 1); -#endif /* !VXWORKS */ - - // Send data to server (correctly handles "incomplete writes"). - - for (ssize_t r_bytes; - (r_bytes = ACE_OS::read (ACE_STDIN, buf, sizeof buf)) > 0; ) - if (ACE_OS::strcmp (buf, "quit\n") == 0) - break; - else if (cli_stream.send (buf, r_bytes, 0, &timeout) == -1) - { - if (errno == ETIME) - ACE_DEBUG ((LM_DEBUG, "%p\n", "send_n")); - else - // Breakout if we didn't fail due to a timeout. - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "send_n"), -1); - } - - // Explicitly close the writer-side of the connection. - if (cli_stream.close_writer () == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "close_writer"), 1); - - // Wait for handshake with server. - if (cli_stream.recv_n (buf, 1) != 1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "recv_n"), 1); - - // Close the connection completely. - if (cli_stream.close () == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "close"), 1); - - return 0; -} diff --git a/examples/IPC_SAP/SOCK_SAP/CPP-inserver-poll.cpp b/examples/IPC_SAP/SOCK_SAP/CPP-inserver-poll.cpp deleted file mode 100644 index 9ba1fa02ad4..00000000000 --- a/examples/IPC_SAP/SOCK_SAP/CPP-inserver-poll.cpp +++ /dev/null @@ -1,101 +0,0 @@ -// IPC_SAP/poll server, which illustrates how to integrate the ACE -// $Id$ - -// socket wrappers with the SVR4 poll() system call to create a -// single-threaded concurrent server. - -#include "ace/SOCK_Acceptor.h" -#include "ace/SOCK_Stream.h" -#include "ace/INET_Addr.h" - -#if defined (ACE_HAS_SVR4_POLL) - -// Maximum per-process open I/O descriptors. -const int MAX_FDS = 200; - -int -main (void) -{ - // Create a server end-point. - ACE_INET_Addr addr (ACE_DEFAULT_SERVER_PORT); - ACE_SOCK_Acceptor peer_acceptor (addr); - ACE_SOCK_Stream new_stream; - ACE_HANDLE s_handle = peer_acceptor.get_handle (); - struct pollfd poll_array[MAX_FDS]; - - for (int i = 0; i < MAX_FDS; i++) - { - poll_array[i].fd = ACE::INVALID_HANDLE; - poll_array[i].events = POLLIN; - } - - poll_array[0].fd = s_handle; - - for (int n_handles = 1;;) - { - // Wait for client I/O events (handle interrupts). - while (ACE_OS::poll (poll_array, n_handles) == -1 - && errno == EINTR) - continue; - - // Handle pending logging messages first (s_handle + 1 is - // guaranteed to be lowest client descriptor). - - for (i = 1; i < n_handles; i++) - { - if (poll_array[i].revents & POLLIN) - { - char buf[BUFSIZ]; - int n; - // recv will not block in this case! - if ((n = ACE_OS::recv (poll_array[i].fd, buf, sizeof buf, 0)) == -1) - ACE_OS::perror ("read failed"); - else if (n == 0) - { - // Handle client connection shutdown. - if (ACE_OS::close (poll_array[i].fd) == -1) - ACE_OS::perror ("close"); - poll_array[i].fd = poll_array[--n_handles].fd; - - // Send handshake back to client to unblock it. - if (ACE_OS::send (poll_array[i].fd, "", 1) != 1) - ACE_ERROR ((LM_ERROR, "%p\n", "send_n")); - } - else - ACE_OS::printf ("%*s", n, buf), fflush (stdout); - } - ACE_OS::fflush (stdout); - } - if (poll_array[0].revents & POLLIN) - { - ACE_INET_Addr client; - ACE_Time_Value nonblock (0, 0); - - // Handle all pending connection requests (note use of - // "polling" feature that doesn't block). - - while (ACE_OS::poll (poll_array, 1, nonblock) > 0) - if (peer_acceptor.accept (new_stream, &client) == -1) - ACE_OS::perror ("accept"); - else - { - const char *s = client.get_host_name (); - - ACE_ASSERT (s != 0); - ACE_OS::printf ("client %s\n", s); - ACE_OS::fflush (stdout); - poll_array[n_handles++].fd = new_stream.get_handle (); - } - } - } - /* NOTREACHED */ - return 0; -} -#else -#include <stdio.h> -int main (void) -{ - ACE_OS::fprintf (stderr, "This feature is not supported\n"); - return 0; -} -#endif /* ACE_HAS_SVR4_POLL */ diff --git a/examples/IPC_SAP/SOCK_SAP/CPP-inserver.cpp b/examples/IPC_SAP/SOCK_SAP/CPP-inserver.cpp deleted file mode 100644 index 313d1c683b6..00000000000 --- a/examples/IPC_SAP/SOCK_SAP/CPP-inserver.cpp +++ /dev/null @@ -1,150 +0,0 @@ -// This example tests the non-blocking features of the -// ACE_SOCK_Acceptor and ACE_SOCK_Stream classes. -// $Id$ - - -#include "ace/SOCK_Acceptor.h" -#include "ace/SOCK_Stream.h" -#include "ace/INET_Addr.h" -#include "ace/Handle_Set.h" - -// ACE SOCK_SAP server. - -int -main (int argc, char *argv[]) -{ - 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); - int sleep_time = argc > 3 ? ACE_OS::atoi (argv[3]) : 0; - - ACE_SOCK_Acceptor peer_acceptor; - - // Create a server address. - ACE_INET_Addr server_addr (port); - - // Create a server, reuse the address. - if (peer_acceptor.open (server_addr, 1) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "open"), 1); -#if !defined(VXWORKS) - // Set the peer acceptor into non-blocking mode. - else if (peer_acceptor.enable (ACE_NONBLOCK) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "enable"), 1); -#endif /* !VXWORKS */ - else if (peer_acceptor.get_local_addr (server_addr) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "get_local_addr"), 1); - - ACE_DEBUG ((LM_DEBUG, "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_SOCK_Stream new_stream; - ACE_INET_Addr cli_addr; - ACE_Handle_Set handle_set; - - // Performs the iterative server activities. - - for (;;) - { - char buf[BUFSIZ]; - - handle_set.reset (); - handle_set.set_bit (peer_acceptor.get_handle ()); - - int result = ACE_OS::select (int (peer_acceptor.get_handle ()) + 1, - handle_set, - 0, 0, timeout); - if (result == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "select"), -1); - else if (result == 0) - ACE_DEBUG ((LM_DEBUG, "select timed out\n")); - else - { - // Create a new ACE_SOCK_Stream endpoint (note automatic restart - // if errno == EINTR). - - while ((result = peer_acceptor.accept (new_stream, &cli_addr)) != -1) - { - ACE_DEBUG ((LM_DEBUG, "client %s connected from %d\n", - cli_addr.get_host_name (), cli_addr.get_port_number ())); - -#if !defined(VXWORKS) - // Enable non-blocking I/O. - if (new_stream.enable (ACE_NONBLOCK) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "enable"), -1); -#endif /* !VXWORKS */ - - handle_set.reset (); - handle_set.set_bit (new_stream.get_handle ()); - - // Read data from client (terminate on error). - - for (ssize_t r_bytes;;) - { - // Wait to read until there's something from the client. - if (ACE_OS::select (int (new_stream.get_handle ()) + 1, - handle_set, - 0, 0, timeout) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "select"), -1); - - // Keep reading until the client shuts down. - for (;;) - { - // Sleep for some amount of time in order to - // test client flow control. - ACE_OS::sleep (sleep_time); - - r_bytes = new_stream.recv (buf, sizeof buf, 0, &timeout); - - if (r_bytes <= 0) - { - if (errno == ETIME) - ACE_ERROR ((LM_ERROR, "%p\n", "ACE::recv")); - break; - } - else if (ACE::write_n (ACE_STDOUT, buf, r_bytes) != r_bytes) - ACE_ERROR ((LM_ERROR, "%p\n", "ACE::send_n")); - } - - if (r_bytes == 0) - { - ACE_DEBUG ((LM_DEBUG, - "reached end of input, connection closed by client\n")); - - // Send handshake back to client to unblock it. - if (new_stream.send_n ("", 1) != 1) - ACE_ERROR ((LM_ERROR, "%p\n", "send_n")); - break; - } - else if (r_bytes == -1) - { - if (errno == EWOULDBLOCK || errno == ETIME) - ACE_DEBUG ((LM_DEBUG, - "no input available, going back to reading\n")); - else - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "recv"), -1); - } - } - - // Close new endpoint (listening endpoint stays open). - if (new_stream.close () == -1) - ACE_ERROR ((LM_ERROR, "%p\n", "close")); - } - - if (result == -1) - { - if (errno == EWOULDBLOCK) - ACE_DEBUG ((LM_DEBUG, - "no connections available, going back to accepting\n")); - else - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE::write"), -1); - } - } - } - /* NOTREACHED */ - return 0; -} diff --git a/examples/IPC_SAP/SOCK_SAP/CPP-unclient.cpp b/examples/IPC_SAP/SOCK_SAP/CPP-unclient.cpp deleted file mode 100644 index 41a1c5db682..00000000000 --- a/examples/IPC_SAP/SOCK_SAP/CPP-unclient.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* ACE_LSOCK Client */ -// $Id$ - - - -#include "ace/LSOCK_Connector.h" -#include "ace/UNIX_Addr.h" - -#if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS) - -int -main (int argc, char *argv[]) -{ - char *rendezvous = argc > 1 ? argv[1] : ACE_DEFAULT_RENDEZVOUS; - char buf[BUFSIZ]; - - ACE_LSOCK_Stream cli_stream; - ACE_LSOCK_Connector con; - - /* Establish the connection with server */ - if (con.connect (cli_stream, ACE_UNIX_Addr (rendezvous)) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "connect"), 1); - - /* Send data to server (correctly handles "incomplete writes") */ - - for (int r_bytes; (r_bytes = ACE_OS::read (ACE_STDIN, buf, sizeof buf)) > 0; ) - if (cli_stream.send_n (buf, r_bytes) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "send_n"), 1); - - /* Explicitly close the writer-side of the connection. */ - if (cli_stream.close_writer () == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "close_writer"), 1); - - /* Wait for handshake with server. */ - if (cli_stream.recv_n (buf, 1) != 1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "recv_n"), 1); - - /* Close the connection completely. */ - if (cli_stream.close () == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "close"), 1); - - return 0; -} -#else -int main (void) -{ - ACE_ERROR_RETURN ((LM_ERROR, - "this platform does not support UNIX-domain sockets\n"), -1); -} -#endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */ diff --git a/examples/IPC_SAP/SOCK_SAP/CPP-unserver.cpp b/examples/IPC_SAP/SOCK_SAP/CPP-unserver.cpp deleted file mode 100644 index 25ecf7aa8cd..00000000000 --- a/examples/IPC_SAP/SOCK_SAP/CPP-unserver.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* ACE_LSOCK Server */ -// $Id$ - - - -#include "ace/LSOCK_Acceptor.h" -#include "ace/LSOCK_Stream.h" -#include "ace/UNIX_Addr.h" - -#if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS) - -int -main (int argc, char *argv[]) -{ - char *rendezvous = argc > 1 ? argv[1] : ACE_DEFAULT_RENDEZVOUS; - - /* Create a server address. */ - ACE_UNIX_Addr server_addr (rendezvous); - - ACE_LSOCK_Acceptor peer_acceptor; - - /* Create a server */ - - if (peer_acceptor.open (server_addr) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "open"), 1); - - /* Keep these guys out here to prevent excessive constructor - calls... */ - ACE_LSOCK_Stream new_stream; - ACE_UNIX_Addr cli_addr; - - ACE_DEBUG ((LM_DEBUG, "starting server %s\n", - server_addr.get_path_name ())); - - /* Performs the iterative server activities */ - - for (;;) - { - char buf[BUFSIZ]; - ACE_Time_Value timeout (ACE_DEFAULT_TIMEOUT); - - /* Create a new ACE_SOCK_Stream endpoint (note - automatic restart if errno == EINTR) */ - - if (peer_acceptor.accept (new_stream, &cli_addr, &timeout) == -1) - { - ACE_ERROR ((LM_ERROR, "%p\n", "accept")); - continue; - } - - ACE_DEBUG ((LM_DEBUG, "client %s\n", - cli_addr.get_path_name ())); - - /* Read data from client (terminate on error) */ - - for (int r_bytes; - (r_bytes = new_stream.recv (buf, sizeof buf)) > 0; ) - if (ACE_OS::write (ACE_STDOUT, buf, r_bytes) != r_bytes) - ACE_ERROR ((LM_ERROR, "%p\n", "ACE::send_n")); - - if (new_stream.send_n ("", 1) != 1) - ACE_ERROR ((LM_ERROR, "%p\n", "send_n")); - - /* Close new endpoint (listening endpoint stays open) */ - if (new_stream.close () == -1) - ACE_ERROR ((LM_ERROR, "%p\n", "close")); - } - - /* NOTREACHED */ - return 0; -} -#else -int main (void) -{ - ACE_ERROR_RETURN ((LM_ERROR, - "this platform does not support UNIX-domain sockets\n"), -1); -} -#endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */ diff --git a/examples/IPC_SAP/SOCK_SAP/FD-unclient.cpp b/examples/IPC_SAP/SOCK_SAP/FD-unclient.cpp deleted file mode 100644 index 2165064ab83..00000000000 --- a/examples/IPC_SAP/SOCK_SAP/FD-unclient.cpp +++ /dev/null @@ -1,50 +0,0 @@ -// $Id$ - -#include "ace/LSOCK_Connector.h" -#include "ace/UNIX_Addr.h" - -#if defined (ACE_HAS_MSG) && !defined (ACE_HAS_UNIX_DOMAIN_SOCKETS) -// ACE_LSOCK Client. - -int -main (int argc, char *argv[]) -{ - char *file_name = argc > 1 ? argv[1] : "./local_data"; - char *rendezvous = argc > 2 ? argv[2] : ACE_DEFAULT_RENDEZVOUS; - ACE_HANDLE handle; - int n; - char buf[BUFSIZ]; - - ACE_LSOCK_Stream cli_stream; - ACE_UNIX_Addr addr (rendezvous); - - // Establish the connection with server. - ACE_LSOCK_Connector connector; - - if (connector.connect (cli_stream, addr) == -1) - ACE_OS::perror ("connect"), ACE_OS::exit (1); - - if ((handle = ACE_OS::open (file_name, O_RDONLY)) == -1) - ACE_OS::perror ("open"), ACE_OS::exit (1); - - // Send handle to server (correctly handles incomplete writes). - if (cli_stream.send_handle (handle) == -1) - ACE_OS::perror ("send"), ACE_OS::exit (1); - - if ((n = cli_stream.recv_n (buf, sizeof buf)) == -1) - ACE_OS::perror ("recv"), ACE_OS::exit (1); - else - ACE_OS::write (ACE_STDOUT, buf, n); - - // Explicitly close the connection. - if (cli_stream.close () == -1) - ACE_OS::perror ("close"), ACE_OS::exit (1); - - return 0; -} -#else -int main (void) -{ - ACE_ERROR_RETURN ((LM_ERROR, "your platform must support sendmsg/recvmsg to run this test\n"), -1); -} -#endif /* ACE_HAS_MSG */ diff --git a/examples/IPC_SAP/SOCK_SAP/FD-unserver.cpp b/examples/IPC_SAP/SOCK_SAP/FD-unserver.cpp deleted file mode 100644 index 38cf2b9de8c..00000000000 --- a/examples/IPC_SAP/SOCK_SAP/FD-unserver.cpp +++ /dev/null @@ -1,61 +0,0 @@ -// $Id$ - -#include "ace/LSOCK_Acceptor.h" -#include "ace/LSOCK_Stream.h" -#include "ace/UNIX_Addr.h" - -#if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS) - -// ACE_LSOCK Server - -int -main (int argc, char *argv[]) -{ - char *rendezvous = argc > 1 ? argv[1] : ACE_DEFAULT_RENDEZVOUS; - // Create a server. - ACE_OS::unlink (rendezvous); - ACE_UNIX_Addr addr (rendezvous); - ACE_LSOCK_Acceptor peer_acceptor (addr); - ACE_LSOCK_Stream new_stream; - - // Performs the iterative server activities. - - for (;;) - { - char buf[BUFSIZ]; - ACE_HANDLE handle; - - // Create a new ACE_SOCK_Stream endpoint. - if (peer_acceptor.accept (new_stream) == -1) - ACE_OS::perror ("accept"); - - // Read data from client (correctly handles incomplete reads due - // to flow control). - - if (new_stream.recv_handle (handle) == -1) - ACE_OS::perror ("recv_handle"), ACE_OS::exit (1); - - ACE_OS::puts ("----------------------------------------"); - - for (int n; (n = ACE_OS::read (handle, buf, sizeof buf)) > 0; ) - ACE_OS::write (ACE_STDOUT, buf, n); - - ACE_OS::puts ("----------------------------------------"); - - if (new_stream.send ("yow", 3) == -1) - ACE_OS::perror ("send"), ACE_OS::exit (1); - - // Close new endpoint (listening endpoint stays open). - if (new_stream.close () == -1) - ACE_OS::perror ("close"); - } - /* NOTREACHED */ - return 0; -} -#else -int -main (void) -{ - ACE_ERROR_RETURN ((LM_ERROR, "your platform doesn't not support UNIX domain sockets\n"), -1); -} -#endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */ diff --git a/examples/IPC_SAP/SOCK_SAP/Makefile b/examples/IPC_SAP/SOCK_SAP/Makefile deleted file mode 100644 index 75eebdece96..00000000000 --- a/examples/IPC_SAP/SOCK_SAP/Makefile +++ /dev/null @@ -1,267 +0,0 @@ -#---------------------------------------------------------------------------- -# @(#)Makefile 1.1 10/18/96 -# -# Makefile for IPC_SAP test -#---------------------------------------------------------------------------- - -#---------------------------------------------------------------------------- -# Local macros -#---------------------------------------------------------------------------- - -INFO = README - -BIN = CPP-inclient \ - CPP-unclient \ - CPP-inserver \ - CPP-inserver-poll \ - CPP-unserver \ - FD-unclient \ - FD-unserver \ - C-inclient \ - C-inserver - -LSRC = $(addsuffix .cpp,$(BIN)) - -VLDLIBS = $(LDLIBS:%=%$(VAR)) - -BUILD = $(VBIN) - -#---------------------------------------------------------------------------- -# Include macros and targets -#---------------------------------------------------------------------------- - -include $(WRAPPER_ROOT)/include/makeinclude/wrapper_macros.GNU -include $(WRAPPER_ROOT)/include/makeinclude/macros.GNU -include $(WRAPPER_ROOT)/include/makeinclude/rules.common.GNU -include $(WRAPPER_ROOT)/include/makeinclude/rules.nonested.GNU -include $(WRAPPER_ROOT)/include/makeinclude/rules.bin.GNU -include $(WRAPPER_ROOT)/include/makeinclude/rules.local.GNU - -#---------------------------------------------------------------------------- -# Local targets -#---------------------------------------------------------------------------- - -#---------------------------------------------------------------------------- -# Dependencies -#---------------------------------------------------------------------------- - -# DO NOT DELETE THIS LINE -- g++dep uses it. -# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. - -.obj/CPP-inclient.o .shobj/CPP-inclient.so: CPP-inclient.cpp \ - $(WRAPPER_ROOT)/ace/SOCK_Connector.h \ - $(WRAPPER_ROOT)/ace/SOCK_Stream.h \ - $(WRAPPER_ROOT)/ace/SOCK_IO.h \ - $(WRAPPER_ROOT)/ace/SOCK.h \ - $(WRAPPER_ROOT)/ace/ACE.h \ - $(WRAPPER_ROOT)/ace/OS.h \ - $(WRAPPER_ROOT)/ace/Time_Value.h \ - $(WRAPPER_ROOT)/ace/config.h \ - $(WRAPPER_ROOT)/ace/stdcpp.h \ - $(WRAPPER_ROOT)/ace/Trace.h \ - $(WRAPPER_ROOT)/ace/Log_Msg.h \ - $(WRAPPER_ROOT)/ace/Log_Record.h \ - $(WRAPPER_ROOT)/ace/Log_Priority.h \ - $(WRAPPER_ROOT)/ace/Log_Record.i \ - $(WRAPPER_ROOT)/ace/ACE.i \ - $(WRAPPER_ROOT)/ace/Addr.h \ - $(WRAPPER_ROOT)/ace/IPC_SAP.h \ - $(WRAPPER_ROOT)/ace/IPC_SAP.i \ - $(WRAPPER_ROOT)/ace/SOCK.i \ - $(WRAPPER_ROOT)/ace/SOCK_IO.i \ - $(WRAPPER_ROOT)/ace/INET_Addr.h \ - $(WRAPPER_ROOT)/ace/SOCK_Stream.i \ - $(WRAPPER_ROOT)/ace/SOCK_Connector.i -.obj/CPP-unclient.o .shobj/CPP-unclient.so: CPP-unclient.cpp \ - $(WRAPPER_ROOT)/ace/LSOCK_Connector.h \ - $(WRAPPER_ROOT)/ace/SOCK_Connector.h \ - $(WRAPPER_ROOT)/ace/SOCK_Stream.h \ - $(WRAPPER_ROOT)/ace/SOCK_IO.h \ - $(WRAPPER_ROOT)/ace/SOCK.h \ - $(WRAPPER_ROOT)/ace/ACE.h \ - $(WRAPPER_ROOT)/ace/OS.h \ - $(WRAPPER_ROOT)/ace/Time_Value.h \ - $(WRAPPER_ROOT)/ace/config.h \ - $(WRAPPER_ROOT)/ace/stdcpp.h \ - $(WRAPPER_ROOT)/ace/Trace.h \ - $(WRAPPER_ROOT)/ace/Log_Msg.h \ - $(WRAPPER_ROOT)/ace/Log_Record.h \ - $(WRAPPER_ROOT)/ace/Log_Priority.h \ - $(WRAPPER_ROOT)/ace/Log_Record.i \ - $(WRAPPER_ROOT)/ace/ACE.i \ - $(WRAPPER_ROOT)/ace/Addr.h \ - $(WRAPPER_ROOT)/ace/IPC_SAP.h \ - $(WRAPPER_ROOT)/ace/IPC_SAP.i \ - $(WRAPPER_ROOT)/ace/SOCK.i \ - $(WRAPPER_ROOT)/ace/SOCK_IO.i \ - $(WRAPPER_ROOT)/ace/INET_Addr.h \ - $(WRAPPER_ROOT)/ace/SOCK_Stream.i \ - $(WRAPPER_ROOT)/ace/SOCK_Connector.i \ - $(WRAPPER_ROOT)/ace/LSOCK_Stream.h \ - $(WRAPPER_ROOT)/ace/LSOCK.h \ - $(WRAPPER_ROOT)/ace/LSOCK.i \ - $(WRAPPER_ROOT)/ace/LSOCK_Stream.i \ - $(WRAPPER_ROOT)/ace/UNIX_Addr.h \ - $(WRAPPER_ROOT)/ace/LSOCK_Connector.i -.obj/CPP-inserver.o .shobj/CPP-inserver.so: CPP-inserver.cpp \ - $(WRAPPER_ROOT)/ace/SOCK_Acceptor.h \ - $(WRAPPER_ROOT)/ace/SOCK_Stream.h \ - $(WRAPPER_ROOT)/ace/SOCK_IO.h \ - $(WRAPPER_ROOT)/ace/SOCK.h \ - $(WRAPPER_ROOT)/ace/ACE.h \ - $(WRAPPER_ROOT)/ace/OS.h \ - $(WRAPPER_ROOT)/ace/Time_Value.h \ - $(WRAPPER_ROOT)/ace/config.h \ - $(WRAPPER_ROOT)/ace/stdcpp.h \ - $(WRAPPER_ROOT)/ace/Trace.h \ - $(WRAPPER_ROOT)/ace/Log_Msg.h \ - $(WRAPPER_ROOT)/ace/Log_Record.h \ - $(WRAPPER_ROOT)/ace/Log_Priority.h \ - $(WRAPPER_ROOT)/ace/Log_Record.i \ - $(WRAPPER_ROOT)/ace/ACE.i \ - $(WRAPPER_ROOT)/ace/Addr.h \ - $(WRAPPER_ROOT)/ace/IPC_SAP.h \ - $(WRAPPER_ROOT)/ace/IPC_SAP.i \ - $(WRAPPER_ROOT)/ace/SOCK.i \ - $(WRAPPER_ROOT)/ace/SOCK_IO.i \ - $(WRAPPER_ROOT)/ace/INET_Addr.h \ - $(WRAPPER_ROOT)/ace/SOCK_Stream.i \ - $(WRAPPER_ROOT)/ace/Handle_Set.h -.obj/CPP-inserver-poll.o .shobj/CPP-inserver-poll.so: CPP-inserver-poll.cpp \ - $(WRAPPER_ROOT)/ace/SOCK_Acceptor.h \ - $(WRAPPER_ROOT)/ace/SOCK_Stream.h \ - $(WRAPPER_ROOT)/ace/SOCK_IO.h \ - $(WRAPPER_ROOT)/ace/SOCK.h \ - $(WRAPPER_ROOT)/ace/ACE.h \ - $(WRAPPER_ROOT)/ace/OS.h \ - $(WRAPPER_ROOT)/ace/Time_Value.h \ - $(WRAPPER_ROOT)/ace/config.h \ - $(WRAPPER_ROOT)/ace/stdcpp.h \ - $(WRAPPER_ROOT)/ace/Trace.h \ - $(WRAPPER_ROOT)/ace/Log_Msg.h \ - $(WRAPPER_ROOT)/ace/Log_Record.h \ - $(WRAPPER_ROOT)/ace/Log_Priority.h \ - $(WRAPPER_ROOT)/ace/Log_Record.i \ - $(WRAPPER_ROOT)/ace/ACE.i \ - $(WRAPPER_ROOT)/ace/Addr.h \ - $(WRAPPER_ROOT)/ace/IPC_SAP.h \ - $(WRAPPER_ROOT)/ace/IPC_SAP.i \ - $(WRAPPER_ROOT)/ace/SOCK.i \ - $(WRAPPER_ROOT)/ace/SOCK_IO.i \ - $(WRAPPER_ROOT)/ace/INET_Addr.h \ - $(WRAPPER_ROOT)/ace/SOCK_Stream.i -.obj/CPP-unserver.o .shobj/CPP-unserver.so: CPP-unserver.cpp \ - $(WRAPPER_ROOT)/ace/LSOCK_Acceptor.h \ - $(WRAPPER_ROOT)/ace/SOCK_Acceptor.h \ - $(WRAPPER_ROOT)/ace/SOCK_Stream.h \ - $(WRAPPER_ROOT)/ace/SOCK_IO.h \ - $(WRAPPER_ROOT)/ace/SOCK.h \ - $(WRAPPER_ROOT)/ace/ACE.h \ - $(WRAPPER_ROOT)/ace/OS.h \ - $(WRAPPER_ROOT)/ace/Time_Value.h \ - $(WRAPPER_ROOT)/ace/config.h \ - $(WRAPPER_ROOT)/ace/stdcpp.h \ - $(WRAPPER_ROOT)/ace/Trace.h \ - $(WRAPPER_ROOT)/ace/Log_Msg.h \ - $(WRAPPER_ROOT)/ace/Log_Record.h \ - $(WRAPPER_ROOT)/ace/Log_Priority.h \ - $(WRAPPER_ROOT)/ace/Log_Record.i \ - $(WRAPPER_ROOT)/ace/ACE.i \ - $(WRAPPER_ROOT)/ace/Addr.h \ - $(WRAPPER_ROOT)/ace/IPC_SAP.h \ - $(WRAPPER_ROOT)/ace/IPC_SAP.i \ - $(WRAPPER_ROOT)/ace/SOCK.i \ - $(WRAPPER_ROOT)/ace/SOCK_IO.i \ - $(WRAPPER_ROOT)/ace/INET_Addr.h \ - $(WRAPPER_ROOT)/ace/SOCK_Stream.i \ - $(WRAPPER_ROOT)/ace/UNIX_Addr.h \ - $(WRAPPER_ROOT)/ace/LSOCK_Stream.h \ - $(WRAPPER_ROOT)/ace/LSOCK.h \ - $(WRAPPER_ROOT)/ace/LSOCK.i \ - $(WRAPPER_ROOT)/ace/LSOCK_Stream.i -.obj/FD-unclient.o .shobj/FD-unclient.so: FD-unclient.cpp \ - $(WRAPPER_ROOT)/ace/LSOCK_Connector.h \ - $(WRAPPER_ROOT)/ace/SOCK_Connector.h \ - $(WRAPPER_ROOT)/ace/SOCK_Stream.h \ - $(WRAPPER_ROOT)/ace/SOCK_IO.h \ - $(WRAPPER_ROOT)/ace/SOCK.h \ - $(WRAPPER_ROOT)/ace/ACE.h \ - $(WRAPPER_ROOT)/ace/OS.h \ - $(WRAPPER_ROOT)/ace/Time_Value.h \ - $(WRAPPER_ROOT)/ace/config.h \ - $(WRAPPER_ROOT)/ace/stdcpp.h \ - $(WRAPPER_ROOT)/ace/Trace.h \ - $(WRAPPER_ROOT)/ace/Log_Msg.h \ - $(WRAPPER_ROOT)/ace/Log_Record.h \ - $(WRAPPER_ROOT)/ace/Log_Priority.h \ - $(WRAPPER_ROOT)/ace/Log_Record.i \ - $(WRAPPER_ROOT)/ace/ACE.i \ - $(WRAPPER_ROOT)/ace/Addr.h \ - $(WRAPPER_ROOT)/ace/IPC_SAP.h \ - $(WRAPPER_ROOT)/ace/IPC_SAP.i \ - $(WRAPPER_ROOT)/ace/SOCK.i \ - $(WRAPPER_ROOT)/ace/SOCK_IO.i \ - $(WRAPPER_ROOT)/ace/INET_Addr.h \ - $(WRAPPER_ROOT)/ace/SOCK_Stream.i \ - $(WRAPPER_ROOT)/ace/SOCK_Connector.i \ - $(WRAPPER_ROOT)/ace/LSOCK_Stream.h \ - $(WRAPPER_ROOT)/ace/LSOCK.h \ - $(WRAPPER_ROOT)/ace/LSOCK.i \ - $(WRAPPER_ROOT)/ace/LSOCK_Stream.i \ - $(WRAPPER_ROOT)/ace/UNIX_Addr.h \ - $(WRAPPER_ROOT)/ace/LSOCK_Connector.i -.obj/FD-unserver.o .shobj/FD-unserver.so: FD-unserver.cpp \ - $(WRAPPER_ROOT)/ace/LSOCK_Acceptor.h \ - $(WRAPPER_ROOT)/ace/SOCK_Acceptor.h \ - $(WRAPPER_ROOT)/ace/SOCK_Stream.h \ - $(WRAPPER_ROOT)/ace/SOCK_IO.h \ - $(WRAPPER_ROOT)/ace/SOCK.h \ - $(WRAPPER_ROOT)/ace/ACE.h \ - $(WRAPPER_ROOT)/ace/OS.h \ - $(WRAPPER_ROOT)/ace/Time_Value.h \ - $(WRAPPER_ROOT)/ace/config.h \ - $(WRAPPER_ROOT)/ace/stdcpp.h \ - $(WRAPPER_ROOT)/ace/Trace.h \ - $(WRAPPER_ROOT)/ace/Log_Msg.h \ - $(WRAPPER_ROOT)/ace/Log_Record.h \ - $(WRAPPER_ROOT)/ace/Log_Priority.h \ - $(WRAPPER_ROOT)/ace/Log_Record.i \ - $(WRAPPER_ROOT)/ace/ACE.i \ - $(WRAPPER_ROOT)/ace/Addr.h \ - $(WRAPPER_ROOT)/ace/IPC_SAP.h \ - $(WRAPPER_ROOT)/ace/IPC_SAP.i \ - $(WRAPPER_ROOT)/ace/SOCK.i \ - $(WRAPPER_ROOT)/ace/SOCK_IO.i \ - $(WRAPPER_ROOT)/ace/INET_Addr.h \ - $(WRAPPER_ROOT)/ace/SOCK_Stream.i \ - $(WRAPPER_ROOT)/ace/UNIX_Addr.h \ - $(WRAPPER_ROOT)/ace/LSOCK_Stream.h \ - $(WRAPPER_ROOT)/ace/LSOCK.h \ - $(WRAPPER_ROOT)/ace/LSOCK.i \ - $(WRAPPER_ROOT)/ace/LSOCK_Stream.i -.obj/C-inclient.o .shobj/C-inclient.so: C-inclient.cpp \ - $(WRAPPER_ROOT)/ace/OS.h \ - $(WRAPPER_ROOT)/ace/Time_Value.h \ - $(WRAPPER_ROOT)/ace/config.h \ - $(WRAPPER_ROOT)/ace/stdcpp.h \ - $(WRAPPER_ROOT)/ace/Trace.h \ - $(WRAPPER_ROOT)/ace/Log_Msg.h \ - $(WRAPPER_ROOT)/ace/Log_Record.h \ - $(WRAPPER_ROOT)/ace/Log_Priority.h \ - $(WRAPPER_ROOT)/ace/ACE.h \ - $(WRAPPER_ROOT)/ace/ACE.i \ - $(WRAPPER_ROOT)/ace/Log_Record.i -.obj/C-inserver.o .shobj/C-inserver.so: C-inserver.cpp \ - $(WRAPPER_ROOT)/ace/OS.h \ - $(WRAPPER_ROOT)/ace/Time_Value.h \ - $(WRAPPER_ROOT)/ace/config.h \ - $(WRAPPER_ROOT)/ace/stdcpp.h \ - $(WRAPPER_ROOT)/ace/Trace.h \ - $(WRAPPER_ROOT)/ace/Log_Msg.h \ - $(WRAPPER_ROOT)/ace/Log_Record.h \ - $(WRAPPER_ROOT)/ace/Log_Priority.h \ - $(WRAPPER_ROOT)/ace/ACE.h \ - $(WRAPPER_ROOT)/ace/ACE.i \ - $(WRAPPER_ROOT)/ace/Log_Record.i - -# IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff --git a/examples/IPC_SAP/SOCK_SAP/README b/examples/IPC_SAP/SOCK_SAP/README deleted file mode 100644 index 9f154faf6de..00000000000 --- a/examples/IPC_SAP/SOCK_SAP/README +++ /dev/null @@ -1,38 +0,0 @@ -This directory contains groups of client and server test programs that -exercise the various C++ wrappers for sockets. In general, the test -programs do more or less the same thing -- the client establishes a -connection with the server and then transfers data to the server, -which keeps printing the data until EOF is reached (e.g., user types -^D). - -Unless noted differently, the server is implemented as an "iterative -server," i.e., it only deals with one client at a time. The following -describes each set of tests in more detail: - - . C-inclient.cpp/C-inserver.cpp -- This is basically a C code - implementation that opens a connection to the server and - sends all the data from the stdin using Internet domain - sockets (i.e., TCP). - - . CPP-inclient.cpp/CPP-server.cpp -- This test is basically - a C++ wrapper version of the preceeding "C" test using - Internet domain sockets (i.e., TCP). - - . CPP-unclient.cpp/CPP-unserver.cpp -- This test is basically - a C++ wrapper version of the preceeding "C++" test using - UNIX domain sockets. - - . FD-unclient.cpp/FD-inclient.cpp -- This test illustrates - how to pass file descriptors between two processes on the - same machine using the ACE C++ wrappers for UNIX domain - sockets. - - . CPP-inserver-poll.cpp -- This test illustrates how to - write single-threaded concurrent servers using UNIX SVR4 - poll(). You can run this test using the CPP-inclient.cpp - program as the client. - -For examples of the ACE SOCK_{Dgram,CODgram} and -SOCK_Dgram_{Mcast,Bcast} wrappers, please take a look in the -./examples/Reactor/{Dgram,Multicast,Ntalker} directories. - diff --git a/examples/IPC_SAP/SOCK_SAP/local_data b/examples/IPC_SAP/SOCK_SAP/local_data deleted file mode 100644 index c0119859a28..00000000000 --- a/examples/IPC_SAP/SOCK_SAP/local_data +++ /dev/null @@ -1 +0,0 @@ -I am Iron man! |