[Ace-users] Re: Port question on how to convert a ACE socket handle
to an ostream object
Evan Carew
carew at pobox.com
Wed Jul 4 13:11:44 CDT 2007
One solution, tho not ideal would be to install gcc on your AIX box.
Having been in the same position in the past, I've actually had to do a
local (to my account) gcc build and install. I finally got what I needed
to work built and installed, but what a pain.
As for the portability issue, there's no guarantee from one compiler
vendor to the next who the underlying stream interface will be
implemented. In gcc, it just happens to be a filebuffer you can extract,
or assign to if you hunt through the gnu interface (as you've shown with
your code snipit).
Devin wrote:
> 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.
>
> Devin
>
> 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