[Ace-users] Port question on how to convert a ACE socket handle to an ostream object

Devin dvn_murray at yahoo.com
Tue Jul 3 09:23:10 CDT 2007

To group,
   I have a Linux program that has the following code section that I
need to update as part of a porting effort from Linux to AIX Unix
(using the C++ compile xlC_r).  It used the non-portable filebuf_gnu
class to convert an ACE_HANDLE (associated with an ACE Socket) to an
ostream object and then later this object object would replace cout so
that the same print calls could be used to output data to the socket
or to standard out.  I'm looking for a standardize way of doing this
under the ACE framework.  I'm using ACE version 5.5.8 compiled on AIX
5.2 for this port effort.  Thank you in advance for your help with
this question.


Here is the code that I need to port ...

int ClientService::handle_input (ACE_HANDLE hHandle)

// Code that fails the port conversion
      filebuf_gnu fbgnu(hHandle, std::ios_base::out, false, 0);
      filebuf &fb = fbgnu;
      streambuf &sb = fb;
      ostream os(&sb);
// Code that fails the port conversion

      // Have removed the remaining code which was basically setting a
ostream pointer to either
      // this object or to cout so that all of the same << calls could
be used to write data either to
      // the socket or to standard out

More information about the Ace-users mailing list