[ace-users] Reading from standard input inside of a Connector
Douglas C. Schmidt
schmidt at dre.vanderbilt.edu
Mon Jul 23 15:25:27 CDT 2007
Thanks very much for using the PRF.
> ACE VERSION: 5.5
In general, I recommend you consider upgrading to ACE+TAO+CIAO x.5.9
(i.e., ACE 5.5.9, TAO 1.5.9, and CIAO 0.5.9), which you can download
under the heading: "Latest Beta Kit".
The DOC groups at Washington University, UC Irvine, and Vanderbilt
University only provide "best effort" support for non-sponsors for the
latest release, as described in
Thus, if you need more "predictable" help for earlier versions of
ACE+TAO, I recommend that you check out
for a list of companies that will provide you with ACE+TAO commercial
> HOST MACHINE and OPERATING SYSTEM:
> x86_64 GNU/Linux Fedora core 6
> TARGET MACHINE and OPERATING SYSTEM, if different from HOST: same
> COMPILER NAME AND VERSION (AND PATCHLEVEL): gcc version 4.1.1
>20070105 (Red Hat 4.1.1-51)
> THE $ACE_ROOT/ace/config.h FILE [if you use a link to a platform-
> specific file, simply state which one]: "ace/config-linux.h"
> THE $ACE_ROOT/include/makeinclude/platform_macros.GNU FILE:
> CONTENTS OF $ACE_ROOT/bin/MakeProjectCreator/config/
> (used by MPC when you generate your own makefiles): ??
> AREA/CLASS/EXAMPLE AFFECTED:
> Connector Framework as defined in the ACE Programmer's Guide
>Section "7.6.3: Using ACE_Connector, and Other Features"
> DOES THE PROBLEM AFFECT:
> Reading from Standard input breaks my Connector Client.
>I built the single-threaded event-handling server that listens on a
>socket as defined in The ACE Programmer's Guide section "7.6.1 Using
>ACE_Acceptor and ACE_Svc_handler". I then built a Client using the
>Connector Framework as defined in the ACE Programmer's Guide Section
>"7.6.3: Using ACE_Connector, and Other Features".
>Initially, my connector client took locally-defined const static
>strings and sent them to the server (via a socket
>connection). Everything worked great: the Acceptor received the
I'm not sure what you mean by "the Acceptor received the message" - an
acceptor is just a factory that creates svc handlers, which
receive/send the message.
>formulated a response, sent it back, and the client read it
>Then in order to make the test code more useful I had the Connector's
>method responsible for gathering input data, handle_timeout(), read
>strings from the input stream "cin" rather than use the statically
>strings. The client was able to put the data on the socket but the
>server wasn't able to read data off of the socket. It said that
>the amount of bytes read was zero.
>After troubleshooting for a while, I reverted the code back to using
>the statically defined strings and got it working again.
>Then I simply added the following two lines.
> string test.
> cin >> test;
>Even though I don't do anything with the "test" string (ie. send it on
>the socket), it still messes up the listening server (Acceptor).
What do you mean by "messes up the listening server"? Do you mean
that the test string you input is incorrectly formatted? If so, have
you printed out the value of the test string you read in from cin to
make sure it's correct? It sounds to me like the string you're typing
in isn't what your server expects..
>If I comment out the 2nd line above, it works. If I uncomment, it
>I'm trying to figure out if/why the C++'s input stream doesn't work
>from inside a Connector's event handling callback routines.
That shouldn't have anything to do with anything.
>If someone tells me that it should work then this is useful
>and I'll continue to push ahead. Meanwhile, I'll try reading from a
>file stream and see if that works.
I suggest you first spend some time debugging your client to make sure
that your test string actually has the info that you expect.
Dr. Douglas C. Schmidt Professor and Associate Chair
Electrical Engineering and Computer Science TEL: (615) 343-8197
Vanderbilt University WEB: www.dre.vanderbilt.edu/~schmidt
Nashville, TN 37203 NET: d.schmidt at vanderbilt.edu
More information about the Ace-users