summaryrefslogtreecommitdiff
path: root/examples/Connection/non_blocking/CPP-connector.cpp
diff options
context:
space:
mode:
authorirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-10-10 20:33:32 +0000
committerirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-10-10 20:33:32 +0000
commit996ffae697d19d79bc022d71a5944bb652283225 (patch)
treeabd3715abf98525d69b597b2afdaa0b72661fe8b /examples/Connection/non_blocking/CPP-connector.cpp
parent91d08ffcb4fd7afe34fb395f65d462b8f3e4c535 (diff)
downloadATCD-996ffae697d19d79bc022d71a5944bb652283225.tar.gz
*** empty log message ***
Diffstat (limited to 'examples/Connection/non_blocking/CPP-connector.cpp')
-rw-r--r--examples/Connection/non_blocking/CPP-connector.cpp36
1 files changed, 25 insertions, 11 deletions
diff --git a/examples/Connection/non_blocking/CPP-connector.cpp b/examples/Connection/non_blocking/CPP-connector.cpp
index 9ffdc34b4de..17324e9cca9 100644
--- a/examples/Connection/non_blocking/CPP-connector.cpp
+++ b/examples/Connection/non_blocking/CPP-connector.cpp
@@ -22,12 +22,23 @@ Peer_Handler<PR_ST_2>::Peer_Handler (ACE_Reactor *r)
template <PR_ST_1> int
Peer_Handler<PR_ST_2>::open (void *)
{
- ACE_DEBUG ((LM_DEBUG, "activating %d\n", this->get_handle ()));
+ ACE_DEBUG ((LM_DEBUG, "activating %d\n", this->peer ().get_handle ()));
this->action_ = &Peer_Handler<PR_ST_2>::connected;
+ ACE_DEBUG ((LM_DEBUG, "please enter input..: "));
+
if (this->reactor ())
+#if defined (ACE_WIN32)
+ // On Win32, the std handle must be registered directly (and not
+ // as a socket)
+ this->reactor ()->register_handler
+ (this, ACE_STDIN);
+#else
+ // On non-Win32, the std handle must be registered as a normal
+ // handle with the READ mask
this->reactor ()->register_handler
- (this, ACE_Event_Handler::WRITE_MASK);
+ (ACE_STDIN, this, ACE_Event_Handler::READ_MASK);
+#endif /* ACE_WIN32 */
else
{
while (this->connected () != -1)
@@ -39,12 +50,6 @@ Peer_Handler<PR_ST_2>::open (void *)
return 0;
}
-template <PR_ST_1> ACE_HANDLE
-Peer_Handler<PR_ST_2>::get_handle (void) const
-{
- return this->peer ().get_handle ();
-}
-
template <PR_ST_1> int
Peer_Handler<PR_ST_2>::disconnecting (void)
{
@@ -70,8 +75,6 @@ Peer_Handler<PR_ST_2>::connected (void)
{
char buf[BUFSIZ];
- ACE_DEBUG ((LM_DEBUG, "please enter input..: "));
-
ssize_t n = ACE_OS::read (ACE_STDIN, buf, sizeof buf);
if (n > 0 && this->peer ().send_n (buf, n) != n)
@@ -85,7 +88,10 @@ Peer_Handler<PR_ST_2>::connected (void)
return -1;
}
else
- return 0;
+ {
+ ACE_DEBUG ((LM_DEBUG, "please enter input..: "));
+ return 0;
+ }
}
template <PR_ST_1> int
@@ -115,6 +121,14 @@ Peer_Handler<PR_ST_2>::handle_output (ACE_HANDLE)
}
template <PR_ST_1> int
+Peer_Handler<PR_ST_2>::handle_signal (int signum, siginfo_t *, ucontext_t *)
+{
+ ACE_DEBUG ((LM_DEBUG, "in handle_signal\n"));
+
+ return (this->*action_) ();
+}
+
+template <PR_ST_1> int
Peer_Handler<PR_ST_2>::handle_input (ACE_HANDLE)
{
ACE_DEBUG ((LM_DEBUG, "in handle_input\n"));