summaryrefslogtreecommitdiff
path: root/examples/IOStream
diff options
context:
space:
mode:
authorlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-02-06 17:58:47 +0000
committerlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-02-06 17:58:47 +0000
commitbf84189f5642ba8006879befe730e4e6ac72d245 (patch)
tree3fa564bd7a72e8f6a549f4e2a5f9587948e3843d /examples/IOStream
parentefcd564fb8ae96f9c6e019cbfbf55eef2daf621a (diff)
downloadATCD-bf84189f5642ba8006879befe730e4e6ac72d245.tar.gz
synch with James
Diffstat (limited to 'examples/IOStream')
-rw-r--r--examples/IOStream/client/iostream_client.cpp11
-rw-r--r--examples/IOStream/server/iostream_server.cpp15
2 files changed, 14 insertions, 12 deletions
diff --git a/examples/IOStream/client/iostream_client.cpp b/examples/IOStream/client/iostream_client.cpp
index b18dd87c550..7ad9245bb26 100644
--- a/examples/IOStream/client/iostream_client.cpp
+++ b/examples/IOStream/client/iostream_client.cpp
@@ -12,16 +12,15 @@ int main (int argc, char *argv[])
if (connector.connect (server, addr) == -1)
ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "open"), -1);
-
- server << "1 2.3 testing" << endl; // Command the server to execute function 'foo'
- server.sync (); // Force the data to the server.
+
+ server << "1 2.3 testing" << endl; // Buffer up some things to send to the server.
int i;
float f;
#if defined (__GNUC__)
String s1;
- QuotedString s2;
+ String s2;
server >> s1 >> i >> f >> s2;
cerr << "Server said:\n\t";
@@ -30,9 +29,11 @@ int main (int argc, char *argv[])
cerr << f << " ";
cerr << s2 << endl;
#else
- server >> i >> f;
+ String s1;
+ server s1 >> i >> f;
cerr << "Server said:\n\t";
+ cerr << s1 << " ";
cerr << i << " ";
cerr << f << endl;
#endif /* __GNUC__ */
diff --git a/examples/IOStream/server/iostream_server.cpp b/examples/IOStream/server/iostream_server.cpp
index c4cd945e044..8aab10de103 100644
--- a/examples/IOStream/server/iostream_server.cpp
+++ b/examples/IOStream/server/iostream_server.cpp
@@ -62,17 +62,18 @@ public:
if (!(this -> peer () >> i >> f >> s))
{
- cerr << "Error getting data" << endl ;
- return - 1 ;
+ cerr << "Server: Error getting data" << endl ;
+ return - 1 ;
}
- cerr << "Received (" << i << ") (" << f << ") (" << s << ")" << endl ;
+ cerr << "Server Received: (" << i << ") (" << f << ") (" << s << ")" << endl ;
- if (!(this -> peer () << "Received (" << i << ") (" << f << ") (" << s << ")" << endl))
+ if (!(this -> peer () << "Received: " << i << " " << f << " " << s << endl))
{
cerr << __LINE__ << "Error sending data" << endl ;
return - 1 ;
}
+
#else
if (!(this -> peer () >> i >> f))
{
@@ -82,7 +83,7 @@ public:
cerr << "Received (" << i << ") (" << f << ")" << endl;
- if (!(this -> peer () << "Received (" << i << ") (" << f << ")" << endl))
+ if (!(this -> peer () << i << " " << f << endl))
{
cerr << __LINE__ << "Error sending data" << endl ;
return - 1 ;
@@ -92,7 +93,7 @@ public:
// sync () function. Some iostreams implementations let us use a
// 'flush' function much like the 'endl' function.
- this->peer ().sync ();
+ // this->peer ().sync ();
return 0;
}
};
@@ -121,7 +122,7 @@ main (int argc, char *argv [])
Logging_Acceptor peer_acceptor ;
- if (peer_acceptor.open (ACE_INET_Addr (argc > 1 ? atoi (argv[1]) : ACE_DEFAULT_SERVER_PORT)) == - 1)
+ if (peer_acceptor.open (ACE_INET_Addr (argc > 1 ? atoi (argv[1]) : ACE_DEFAULT_SERVER_PORT)) == - 1)
ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "open"), - 1);
else if (ACE_Service_Config::reactor ()->register_handler