summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>1998-05-14 22:03:45 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>1998-05-14 22:03:45 +0000
commitcd9ddddd15d5eacdfd47c76d0a00d87c8a0901d6 (patch)
tree3542786085fd39d43241fc9a8e760c643e047958
parent9fcaa4fad72752b510868ca51347f6940da07a56 (diff)
downloadATCD-cd9ddddd15d5eacdfd47c76d0a00d87c8a0901d6.tar.gz
*** empty log message ***
-rw-r--r--examples/IPC_SAP/SOCK_SAP/CPP-inclient.cpp8
-rw-r--r--examples/IPC_SAP/SOCK_SAP/CPP-inserver-fancy.cpp435
-rw-r--r--examples/IPC_SAP/SOCK_SAP/CPP-inserver-poll.cpp191
-rw-r--r--examples/IPC_SAP/SOCK_SAP/CPP-inserver.cpp14
-rw-r--r--examples/IPC_SAP/SOCK_SAP/README26
5 files changed, 592 insertions, 82 deletions
diff --git a/examples/IPC_SAP/SOCK_SAP/CPP-inclient.cpp b/examples/IPC_SAP/SOCK_SAP/CPP-inclient.cpp
index 64dcf2920c8..f0864caf0ad 100644
--- a/examples/IPC_SAP/SOCK_SAP/CPP-inclient.cpp
+++ b/examples/IPC_SAP/SOCK_SAP/CPP-inclient.cpp
@@ -267,10 +267,10 @@ Options::oneway_client_test (void *)
remote_addr.get_host_name (),
remote_addr.get_port_number ()));
- ACE_UINT32 len = htonl (options->message_len ());
+ ACE_INT32 len = htonl (options->message_len ());
if (cli_stream.send_n ((void *) &len,
- sizeof (ACE_UINT32)) != sizeof (ACE_UINT32))
+ sizeof (ACE_INT32)) != sizeof (ACE_INT32))
ACE_ERROR_RETURN ((LM_ERROR,
"(%P|%t) %p\n",
"send_n failed"),
@@ -343,10 +343,10 @@ Options::twoway_client_test (void *)
remote_addr.get_host_name (),
remote_addr.get_port_number ()));
- ACE_UINT32 len = htonl (options->message_len ());
+ ACE_INT32 len = htonl (options->message_len ());
if (cli_stream.send_n ((void *) &len,
- sizeof (ACE_UINT32)) != sizeof (ACE_UINT32))
+ sizeof (ACE_INT32)) != sizeof (ACE_INT32))
ACE_ERROR_RETURN ((LM_ERROR,
"(%P|%t) %p\n",
"send_n failed"),
diff --git a/examples/IPC_SAP/SOCK_SAP/CPP-inserver-fancy.cpp b/examples/IPC_SAP/SOCK_SAP/CPP-inserver-fancy.cpp
new file mode 100644
index 00000000000..205c39a628b
--- /dev/null
+++ b/examples/IPC_SAP/SOCK_SAP/CPP-inserver-fancy.cpp
@@ -0,0 +1,435 @@
+// $Id$
+
+// This example tests the features of the <ACE_SOCK_Acceptor>,
+// <ACE_SOCK_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/SOCK_Acceptor.h"
+#include "ace/Svc_Handler.h"
+#include "ace/Profile_Timer.h"
+
+// Forward declaration.
+class Handler;
+
+class Handler_Factory
+{
+ // = TITLE
+ // Creates oneway or twoway handlers.
+public:
+ Handler_Factory (u_short port);
+ // Constructor.
+
+ ~Handler_Factory (void);
+ // Destructor.
+
+ int handle_events (void);
+ // Run the main event loop.
+
+private:
+ int init_acceptors (void);
+ // Initialize the acceptors.
+
+ int create_handler (ACE_SOCK_Acceptor &acceptor,
+ Handler *(*handler_factory) (ACE_HANDLE),
+ const char *handler_type);
+ // Factory that creates the right kind of <Handler>.
+
+ // = Factory functions.
+ static Handler *make_twoway_handler (ACE_HANDLE);
+ // Create a twoway handler.
+
+ static Handler *make_oneway_handler (ACE_HANDLE);
+ // Create a oneway handler.
+
+ u_short port_;
+ // Port number we're listening on.
+
+ ACE_SOCK_Acceptor twoway_acceptor_;
+ // Twoway acceptor factory.
+
+ ACE_SOCK_Acceptor oneway_acceptor_;
+ // Oneway acceptor factory.
+};
+
+class Handler : public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>
+{
+ // = TITLE
+ // Base class for the oneway and twoway handlers.
+public:
+ virtual int open (void * = 0);
+ // Generic initialization method.
+
+protected:
+ Handler (ACE_HANDLE handle, int verbose = 0);
+ // Constructor.
+
+ virtual int run (void) = 0;
+ // Hook method called by the <svc> template method to do the actual
+ // protocol. Must be overridden by the subclass.
+
+ virtual int svc (void);
+ // Template method entry point into the handler task.
+
+ void print_results (void);
+ // Print the results.
+
+ int verbose_;
+ // Are we running verbosely?
+
+ size_t total_bytes_;
+ // Total number of bytes received.
+
+ size_t message_count_;
+ // Number of messages received.
+
+ ACE_INT32 len_;
+ // Max length of buffers sent by the user.
+
+ void *buf_;
+ // Pointer to the buffer that we read into.
+
+ ACE_Profile_Timer timer_;
+ // Keeps track of how much time we're using.
+};
+
+class Twoway_Handler : public Handler
+{
+ // = TITLE
+ // Performs the twoway protocol.
+public:
+ Twoway_Handler (ACE_HANDLE handle, int verbose = 0);
+ // Constructor.
+
+ virtual int run (void);
+ // Template Method hook called by <svc>.
+};
+
+class Oneway_Handler : public Handler
+{
+ // = TITLE
+public:
+ Oneway_Handler (ACE_HANDLE handle, int verbose = 0);
+ // Constructor.
+
+ virtual int run (void);
+ // Template Method hook called by <svc>.
+};
+
+Handler::Handler (ACE_HANDLE handle,
+ int verbose)
+ : verbose_ (verbose),
+ total_bytes_ (0),
+ message_count_ (0),
+ len_ (0),
+ buf_ (0)
+{
+ this->peer ().set_handle (handle);
+}
+
+int
+Handler::open (void *)
+{
+ ACE_INET_Addr cli_addr;
+
+ // Make sure we're not in non-blocking mode.
+ if (this->peer ().disable (ACE_NONBLOCK) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p\n",
+ "disable"),
+ 0);
+
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t) client %s connected from %d on handle %d\n",
+ cli_addr.get_host_name (),
+ cli_addr.get_port_number (),
+ this->peer ().get_handle ()));
+
+ if (this->peer ().recv_n ((void *) &this->len_,
+ sizeof (ACE_UINT32)) != sizeof (ACE_UINT32))
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%P|%t) %p\n",
+ "recv_n failed"),
+ -1);
+ else
+ {
+ this->len_ = ntohl (this->len_);
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t) reading messages of size %d\n",
+ this->len_));
+ ACE_ALLOCATOR_RETURN (this->buf_,
+ ACE_OS::malloc (this->len_),
+ -1);
+ }
+ return 0;
+}
+
+void
+Handler::print_results (void)
+{
+ ACE_Profile_Timer::ACE_Elapsed_Time et;
+ this->timer_.elapsed_time (et);
+
+ ACE_DEBUG ((LM_DEBUG,
+ ASYS_TEXT ("\t\treal time = %f secs \n\t\tuser time = %f secs \n\t\tsystem time = %f secs\n"),
+ et.real_time,
+ et.user_time,
+ et.system_time));
+
+ ACE_DEBUG ((LM_DEBUG,
+ ASYS_TEXT ("\t\t messages = %d\n\t\t total bytes = %d\n\t\tmbits/sec = %f\n\t\tusec-per-message = %f\n"),
+ this->message_count_,
+ this->total_bytes_,
+ (((double) this->total_bytes_ * 8) / et.real_time) / (double) (1024 * 1024),
+ ((et.user_time + et.system_time) / (double) this->message_count_) * ACE_ONE_SECOND_IN_USECS));
+}
+
+int
+Handler::svc (void)
+{
+ // Timer logic.
+ this->timer_.start ();
+
+ if (this->run () == -1)
+ return -1;
+
+ this->timer_.stop ();
+
+ this->print_results ();
+ ACE_OS::free (this->buf_);
+ return 0;
+}
+
+Twoway_Handler::Twoway_Handler (ACE_HANDLE handle,
+ int verbose)
+ : Handler (handle, verbose)
+{
+}
+
+// Function entry point into the twoway server task.
+
+int
+Twoway_Handler::run (void)
+{
+ // Read data from client (terminate on error).
+
+ for (;;)
+ {
+ ssize_t r_bytes = this->peer ().recv (this->buf_, this->len_);
+
+ if (r_bytes == -1)
+ {
+ ACE_ERROR ((LM_ERROR, "%p\n", "recv"));
+ break;
+ }
+ else if (r_bytes == 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t) reached end of input, connection closed by client\n"));
+ break;
+ }
+ else if (this->verbose_
+ && ACE::write_n (ACE_STDOUT, this->buf_, r_bytes) != r_bytes)
+ ACE_ERROR ((LM_ERROR,
+ "%p\n",
+ "ACE::write_n"));
+ else if (this->peer ().send_n (this->buf_, r_bytes) != r_bytes)
+ ACE_ERROR ((LM_ERROR,
+ "%p\n",
+ "send_n"));
+
+ this->total_bytes_ += size_t (r_bytes);
+ this->message_count_++;
+ }
+ return 0;
+}
+
+Oneway_Handler::Oneway_Handler (ACE_HANDLE handle,
+ int verbose)
+ : Handler (handle, verbose)
+{
+}
+
+// Function entry point into the oneway server task.
+
+int
+Oneway_Handler::run (void)
+{
+ // Read data from client (terminate on error).
+
+ for (;;)
+ {
+ ssize_t r_bytes = this->peer ().recv (this->buf_, this->len_);
+
+ if (r_bytes == -1)
+ {
+ ACE_ERROR ((LM_ERROR, "%p\n", "recv"));
+ break;
+ }
+ else if (r_bytes == 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t) reached end of input, connection closed by client\n"));
+ break;
+ }
+ else if (this->verbose_
+ && ACE::write_n (ACE_STDOUT, this->buf_, r_bytes) != r_bytes)
+ ACE_ERROR ((LM_ERROR,
+ "%p\n",
+ "ACE::write_n"));
+
+ this->total_bytes_ += size_t (r_bytes);
+ this->message_count_++;
+ }
+ return 0;
+}
+
+// Create a twoway handler.
+
+Handler *
+Handler_Factory::make_twoway_handler (ACE_HANDLE handle)
+{
+ return new Twoway_Handler (handle);
+}
+
+// Create a oneway handler.
+
+Handler *
+Handler_Factory::make_oneway_handler (ACE_HANDLE handle)
+{
+ return new Oneway_Handler (handle);
+}
+
+int
+Handler_Factory::init_acceptors (void)
+{
+ // Create the oneway and twoway server addresses.
+ ACE_INET_Addr twoway_server_addr (this->port_);
+ ACE_INET_Addr oneway_server_addr (this->port_ + 1);
+
+ // Create acceptors, reuse the address.
+ if (this->twoway_acceptor_.open (twoway_server_addr, 1) == -1
+ || this->oneway_acceptor_.open (oneway_server_addr, 1) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p\n",
+ "open"),
+ -1);
+ else if (this->twoway_acceptor_.get_local_addr (twoway_server_addr) == -1
+ || this->oneway_acceptor_.get_local_addr (oneway_server_addr) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p\n",
+ "get_local_addr"),
+ -1);
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t) starting twoway server at port %d and oneway server at port %d\n",
+ twoway_server_addr.get_port_number (),
+ oneway_server_addr.get_port_number ()));
+ return 0;
+}
+
+int
+Handler_Factory::create_handler (ACE_SOCK_Acceptor &acceptor,
+ Handler * (*handler_factory) (ACE_HANDLE),
+ const char *handler_type)
+{
+ ACE_SOCK_Stream new_stream;
+
+ if (acceptor.accept (new_stream) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p\n",
+ "accept"),
+ -1);
+
+ Handler *handler;
+
+ ACE_ALLOCATOR_RETURN (handler,
+ (*handler_factory) (new_stream.get_handle ()),
+ -1);
+
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t) spawning %s handler\n",
+ handler_type));
+
+ if (handler->open () == -1)
+ return -1;
+
+#if defined (ACE_MT_SAFE)
+ // Spawn a new thread and run the new connection in that thread of
+ // control using the <server> function as the entry point.
+ return handler->activate ();
+#else
+ handler->svc ();
+ handler->close ();
+#endif /* ACE_HAS_THREADS */
+}
+
+Handler_Factory::Handler_Factory (u_short port)
+ : port_ (port)
+
+{
+}
+
+Handler_Factory::~Handler_Factory (void)
+{
+ this->twoway_acceptor_.close ();
+ this->oneway_acceptor_.close ();
+}
+
+// Run the main event loop.
+
+int
+Handler_Factory::handle_events (void)
+{
+ if (this->init_acceptors () == -1)
+ return -1;
+
+ fd_set handles;
+
+ FD_ZERO (&handles);
+ FD_SET (this->twoway_acceptor_.get_handle (), &handles);
+ FD_SET (this->oneway_acceptor_.get_handle (), &handles);
+
+ // Performs the iterative server activities.
+
+ for (;;)
+ {
+ ACE_Time_Value timeout (ACE_DEFAULT_TIMEOUT);
+ fd_set temp = handles;
+
+ int result = ACE_OS::select (int (this->oneway_acceptor_.get_handle ()) + 1,
+ (fd_set *) &temp,
+ 0,
+ 0,
+ timeout);
+ if (result == -1)
+ ACE_ERROR ((LM_ERROR,
+ "(%P|%t) %p\n", "select"));
+ else if (result == 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t) select timed out\n"));
+ else
+ {
+ if (FD_ISSET (this->twoway_acceptor_.get_handle (), &temp))
+ this->create_handler (this->twoway_acceptor_,
+ &Handler_Factory::make_twoway_handler,
+ "twoway");
+ if (FD_ISSET (this->oneway_acceptor_.get_handle (), &temp))
+ this->create_handler (this->oneway_acceptor_,
+ &Handler_Factory::make_oneway_handler,
+ "oneway");
+ }
+ }
+
+ /* NOTREACHED */
+ return 0;
+}
+
+int
+main (int argc, char *argv[])
+{
+ u_short port = argc > 1 ? ACE_OS::atoi (argv[1]) : ACE_DEFAULT_SERVER_PORT;
+
+ Handler_Factory server (port);
+
+ return server.handle_events ();
+}
diff --git a/examples/IPC_SAP/SOCK_SAP/CPP-inserver-poll.cpp b/examples/IPC_SAP/SOCK_SAP/CPP-inserver-poll.cpp
index 92798c3d46a..efd0a777a73 100644
--- a/examples/IPC_SAP/SOCK_SAP/CPP-inserver-poll.cpp
+++ b/examples/IPC_SAP/SOCK_SAP/CPP-inserver-poll.cpp
@@ -1,7 +1,7 @@
// $Id$
// IPC_SAP/poll server, which illustrates how to integrate the ACE
-// socket wrappers with the SVR4 poll() system call to create a
+// socket wrappers with the SVR4 <poll> system call to create a
// single-threaded concurrent server.
#include "ace/SOCK_Acceptor.h"
@@ -10,8 +10,131 @@
#if defined (ACE_HAS_POLL)
-// Maximum per-process open I/O descriptors.
-const int MAX_FDS = 200;
+// Max number of open handles.
+const int MAX_HANDLES = 200;
+
+struct Buffer_Info
+{
+ void *buf_;
+ // Pointer to the buffer.
+
+ size_t len_;
+ // Length of the buffer.
+};
+
+// Array of <pollfd>'s.
+static struct pollfd poll_array[MAX_HANDLES];
+
+// Array of <Buffer_Info>.
+static Buffer_Info buffer_array[MAX_HANDLES];
+
+static void
+init_poll_array (void)
+{
+ int i;
+
+ for (i = 0; i < MAX_HANDLES; i++)
+ {
+ poll_array[i].fd = ACE_INVALID_HANDLE;
+ poll_array[i].events = POLLIN;
+ }
+}
+
+static int
+init_buffer (ACE_HANDLE handle)
+{
+ if (ACE::recv_n (handle,
+ (void *) &buffer_array[handle].len_,
+ sizeof (ACE_UINT32)) != sizeof (ACE_UINT32))
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%P|%t) %p\n",
+ "recv_n failed"),
+ 0);
+ else
+ {
+ buffer_array[handle].len_ =
+ ntohl (buffer_array[handle].len_);
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t) reading messages of size %d\n",
+ buffer_array[handle].len_));
+ buffer_array[handle].buf_ =
+ ACE_OS::malloc (buffer_array[handle].len_);
+ }
+}
+
+static void
+handle_data (size_t n_handles)
+{
+ // Handle pending logging messages first (s_handle + 1 is guaranteed
+ // to be lowest client descriptor).
+
+ for (ACE_HANDLE handle = 1; handle < n_handles; handle++)
+ {
+ if (ACE_BIT_ENABLED (poll_array[handle].revents, POLLIN))
+ {
+ // Read data from client (terminate on error).
+
+ // First time in -- gotta initialize the buffer.
+ if (buffer_array[handle].buf_ == 0)
+ init_buffer (handle);
+
+ ssize_t n = ACE::recv (poll_array[handle].fd,
+ buffer_array[handle].buf_,
+ buffer_array[handle].len_);
+ // <recv> will not block in this case!
+
+ if (n == -1)
+ ACE_ERROR ((LM_ERROR,
+ "%p\n",
+ "read failed"));
+ else if (n == 0)
+ {
+ // Handle client connection shutdown.
+ ACE_OS::close (poll_array[handle].fd);
+ poll_array[handle].fd = poll_array[--n_handles].fd;
+
+ ACE_OS::free ((void *) buffer_array[handle].buf_);
+ buffer_array[handle].buf_ = 0;
+
+ // Send handshake back to client to unblock it.
+ if (ACE::send (poll_array[handle].fd, "", 1) != 1)
+ ACE_ERROR ((LM_ERROR, "%p\n", "send_n"));
+ }
+ else
+ ACE_OS::printf ("%*s", n, buffer_array[handle].buf_), fflush (stdout);
+ }
+ ACE_OS::fflush (stdout);
+ }
+}
+
+static void
+handle_connections (ACE_SOCK_Acceptor &peer_acceptor,
+ ACE_HANDLE &n_handles)
+{
+ if (ACE_BIT_ENABLED (poll_array[0].revents, POLLIN))
+ {
+ ACE_SOCK_Stream new_stream;
+
+ 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 ();
+ }
+ }
+}
int
main (int, char *[])
@@ -19,16 +142,10 @@ main (int, char *[])
// 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];
- int i;
- for (i = 0; i < MAX_FDS; i++)
- {
- poll_array[i].fd = ACE_INVALID_HANDLE;
- poll_array[i].events = POLLIN;
- }
+ init_poll_array ();
poll_array[0].fd = s_handle;
@@ -39,56 +156,10 @@ main (int, char *[])
&& 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 ();
- }
- }
+ handle_data (n_handles);
+ handle_connections (peer_acceptor, n_handles);
}
+
/* NOTREACHED */
return 0;
}
diff --git a/examples/IPC_SAP/SOCK_SAP/CPP-inserver.cpp b/examples/IPC_SAP/SOCK_SAP/CPP-inserver.cpp
index 57e1c2bd04f..0d8c588adbb 100644
--- a/examples/IPC_SAP/SOCK_SAP/CPP-inserver.cpp
+++ b/examples/IPC_SAP/SOCK_SAP/CPP-inserver.cpp
@@ -1,8 +1,8 @@
// $Id$
-// This example tests the features of the ACE_SOCK_Acceptor and
-// ACE_SOCK_Stream classes. If the platform supports threads it uses
-// a thread-per-connection concurrency model.
+// This example tests the features of the <ACE_SOCK_Acceptor> and
+// <ACE_SOCK_Stream> classes. If the platform supports threads it
+// uses a thread-per-connection concurrency model.
#include "ace/SOCK_Acceptor.h"
#include "ace/Thread_Manager.h"
@@ -43,10 +43,10 @@ twoway_server (void *arg)
size_t message_count = 0;
void *buf;
- ACE_UINT32 len;
+ ACE_INT32 len;
if (new_stream.recv_n ((void *) &len,
- sizeof (ACE_UINT32)) != sizeof (ACE_UINT32))
+ sizeof (ACE_INT32)) != sizeof (ACE_INT32))
ACE_ERROR_RETURN ((LM_ERROR,
"(%P|%t) %p\n",
"recv_n failed"),
@@ -141,10 +141,10 @@ oneway_server (void *arg)
size_t message_count = 0;
void *buf;
- ACE_UINT32 len;
+ ACE_INT32 len;
if (new_stream.recv_n ((void *) &len,
- sizeof (ACE_UINT32)) != sizeof (ACE_UINT32))
+ sizeof (ACE_INT32)) != sizeof (ACE_INT32))
ACE_ERROR_RETURN ((LM_ERROR,
"(%P|%t) %p\n",
"recv_n failed"),
diff --git a/examples/IPC_SAP/SOCK_SAP/README b/examples/IPC_SAP/SOCK_SAP/README
index ea3fd26d8a8..46d344af0ab 100644
--- a/examples/IPC_SAP/SOCK_SAP/README
+++ b/examples/IPC_SAP/SOCK_SAP/README
@@ -9,29 +9,33 @@ 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
+ . C-{inclient,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-{inclient,inserver}.cpp -- This test is
+ a more sophisticated 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
+ . CPP-inserver-fancy.cpp -- This program is a more glitzy
+ version of CPP-inserver.cpp that illustrates additional
+ features of ACE.
+
+ . 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.
+
+ . CPP-{unclient,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
+ . FD-{unclient,inclient}.cpp -- This test illustrates
how to pass file descriptors between a client and a
concurrent server process 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.