summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>1998-05-15 00:50:12 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>1998-05-15 00:50:12 +0000
commit2fdbd9e922334cd2b39f677daabd23812a443e6c (patch)
tree60b1c054c695c158d6e87f2fd1f4ed7adb92fac2
parent135d6bd08066172ba0c2c3fd78190375aa064b73 (diff)
downloadATCD-2fdbd9e922334cd2b39f677daabd23812a443e6c.tar.gz
*** empty log message ***
-rw-r--r--ChangeLog-98b4
-rw-r--r--TAO/tao/orbconf.h12
-rw-r--r--examples/IPC_SAP/SOCK_SAP/CPP-inserver-fancy.cpp2
-rw-r--r--examples/IPC_SAP/SOCK_SAP/CPP-inserver-poll.cpp39
-rw-r--r--examples/IPC_SAP/SOCK_SAP/README4
-rw-r--r--examples/Service_Configurator/IPC-tests/server/svc.conf2
6 files changed, 32 insertions, 31 deletions
diff --git a/ChangeLog-98b b/ChangeLog-98b
index 74b9a6db8f5..f8c6498d301 100644
--- a/ChangeLog-98b
+++ b/ChangeLog-98b
@@ -1,5 +1,9 @@
Thu May 14 15:28:42 1998 Douglas C. Schmidt <schmidt@flamenco.cs.wustl.edu>
+ * examples/IPC_SAP/SOCK_SAP/CPP-inserver-poll.cpp: Enhanced the
+ implementation to make it easier to follow and to support the
+ latest features of CPP-inclient.cpp.
+
* ace/OS.h (ACE_OS): Added a wrapper for strcspn(3s).
* examples/IPC_SAP/SOCK_SAP/CPP-inserver-fancy.cpp: Added more
diff --git a/TAO/tao/orbconf.h b/TAO/tao/orbconf.h
index 3799499aa73..0210356cb15 100644
--- a/TAO/tao/orbconf.h
+++ b/TAO/tao/orbconf.h
@@ -113,14 +113,14 @@
# define TAO_MAXIMUM_NATIVE_TYPE_SIZE 128
#endif /* TAO_MAXIMUM_NATIVE_TYPE_SIZE */
-// This deals with platforms that support namespaces vs platforms that don't.
+// This deals with platforms that support namespaces vs platforms that
+// don't.
#if defined (ACE_HAS_USING_KEYWORD)
#define TAO_NAMESPACE namespace
#else
#define TAO_NAMESPACE struct
-#endif
+#endif /* ACE_HAS_USING_KEYWORD */
-//
// In some environments it is useful to swap the bytes on write, for
// instance: a fast server can be feeding a lot of slow clients that
// happen to have the wrong byte order.
@@ -128,9 +128,7 @@
// need a way to activate it on a per-connection basis.
//
// #define TAO_ENABLE_SWAP_ON_WRITE
-//
-//
// In some environements we never need to swap bytes when reading, for
// instance embebbed systems (such as avionics) or homogenous
// networks.
@@ -138,9 +136,7 @@
// in the wrong byte order.
//
// #define TAO_DISABLE_SWAP_ON_READ
-//
-//
// For some applications it is important to optimize octet sequences
// and minimize the number of copies made of the sequence buffer.
// TAO supports this optimizations by sharing the CDR stream buffer
@@ -156,7 +152,7 @@
#if defined (__WIN32__)
# define _WIN32
-#endif /* BC++ convention */
+#endif /* __WIN32__ */
// Define to `int' if <sys/types.h> doesn't define.
/* #undef pid_t */
diff --git a/examples/IPC_SAP/SOCK_SAP/CPP-inserver-fancy.cpp b/examples/IPC_SAP/SOCK_SAP/CPP-inserver-fancy.cpp
index 205c39a628b..4a5d1ab00c1 100644
--- a/examples/IPC_SAP/SOCK_SAP/CPP-inserver-fancy.cpp
+++ b/examples/IPC_SAP/SOCK_SAP/CPP-inserver-fancy.cpp
@@ -146,7 +146,7 @@ Handler::open (void *)
this->peer ().get_handle ()));
if (this->peer ().recv_n ((void *) &this->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/CPP-inserver-poll.cpp b/examples/IPC_SAP/SOCK_SAP/CPP-inserver-poll.cpp
index abe6d51e088..24af867d410 100644
--- a/examples/IPC_SAP/SOCK_SAP/CPP-inserver-poll.cpp
+++ b/examples/IPC_SAP/SOCK_SAP/CPP-inserver-poll.cpp
@@ -2,7 +2,8 @@
// IPC_SAP/poll server, which illustrates how to integrate the ACE
// socket wrappers with the SVR4 <poll> system call to create a
-// single-threaded concurrent server.
+// single-threaded concurrent server. This server program can be
+// driven by the oneway test mode of CPP-inclient.cpp.
#include "ace/SOCK_Acceptor.h"
#include "ace/SOCK_Stream.h"
@@ -46,28 +47,32 @@ init_poll_array (void)
static int
init_buffer (size_t index)
{
- if (ACE::recv_n (poll_array[index].fd,
- (void *) &buffer_array[index].len_,
- sizeof (ACE_UINT32)) != sizeof (ACE_UINT32))
+ ACE_INT32 len;
+
+ if (ACE::recv_n (poll_array[index].fd,
+ (void *) &len,
+ sizeof (ACE_INT32)) != sizeof (ACE_INT32))
ACE_ERROR_RETURN ((LM_ERROR,
"(%P|%t) %p\n",
"recv_n failed"),
0);
else
{
- buffer_array[index].len_ =
- ntohl (buffer_array[index].len_);
+ len = ntohl (len);
ACE_DEBUG ((LM_DEBUG,
- "(%P|%t) reading messages of size %d\n",
- buffer_array[index].len_));
+ "(%P|%t) reading messages of size %d from handle %d\n",
+ len,
+ poll_array[index].fd));
+
ACE_ALLOCATOR_RETURN (buffer_array[index].buf_,
- ACE_OS::malloc (buffer_array[index].len_),
+ ACE_OS::malloc (len),
-1);
+ buffer_array[index].len_ = len;
}
}
static void
-handle_data (size_t n_handles)
+handle_data (size_t &n_handles)
{
// Handle pending logging messages first (s_handle + 1 is guaranteed
// to be lowest client descriptor).
@@ -76,13 +81,7 @@ handle_data (size_t n_handles)
{
if (ACE_BIT_ENABLED (poll_array[index].revents, POLLIN))
{
- // Read data from client (terminate on error).
-
- ACE_DEBUG ((LM_DEBUG,
- "(%P|%t) buf = %d, handle = %d\n",
- buffer_array[index].buf_,
- poll_array[index].fd));
- // First time in -- gotta initialize the buffer.
+ // First time in, we need to initialize the buffer.
if (buffer_array[index].buf_ == 0
&& init_buffer (index) == -1)
{
@@ -92,6 +91,8 @@ handle_data (size_t n_handles)
continue;
}
+ // Read data from client (terminate on error).
+
ssize_t n = ACE::recv (poll_array[index].fd,
buffer_array[index].buf_,
buffer_array[index].len_);
@@ -126,7 +127,7 @@ handle_data (size_t n_handles)
static void
handle_connections (ACE_SOCK_Acceptor &peer_acceptor,
- ACE_HANDLE &n_handles)
+ size_t &n_handles)
{
if (ACE_BIT_ENABLED (poll_array[0].revents, POLLIN))
{
@@ -173,7 +174,7 @@ main (int, char *[])
"(%P|%t) starting oneway server at port %d\n",
port));
- for (int n_handles = 1;;)
+ for (size_t n_handles = 1;;)
{
// Wait for client I/O events (handle interrupts).
while (ACE_OS::poll (poll_array, n_handles) == -1
diff --git a/examples/IPC_SAP/SOCK_SAP/README b/examples/IPC_SAP/SOCK_SAP/README
index 46d344af0ab..6aa5b10101d 100644
--- a/examples/IPC_SAP/SOCK_SAP/README
+++ b/examples/IPC_SAP/SOCK_SAP/README
@@ -20,12 +20,12 @@ describes each set of tests in more detail:
. CPP-inserver-fancy.cpp -- This program is a more glitzy
version of CPP-inserver.cpp that illustrates additional
- features of ACE.
+ features of ACE, such as ACE_Svc_Handler.
. 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.
+ program as the oneway client.
. CPP-{unclient,unserver}.cpp -- This test is basically
a C++ wrapper version of the preceeding "C++" test using
diff --git a/examples/Service_Configurator/IPC-tests/server/svc.conf b/examples/Service_Configurator/IPC-tests/server/svc.conf
index a895cce1610..b54d2fb4ee2 100644
--- a/examples/Service_Configurator/IPC-tests/server/svc.conf
+++ b/examples/Service_Configurator/IPC-tests/server/svc.conf
@@ -1,5 +1,5 @@
# To configure different services, simply uncomment the appropriate lines in this file!
-#static ACE_Service_Manager "-d -p 3911"
+static ACE_Service_Manager "-d -p 3911"
dynamic Remote_Brdcast Service_Object * ./Server:remote_broadcast "-p 10001"
dynamic Remote_Stream Service_Object * ./Server:remote_stream "-p 20002"
dynamic Remote_Dgram Service_Object * ./Server:remote_dgram "-p 15001"