Boost logo

Boost Users :

Subject: Re: [Boost-users] Problems with boost::asio::local::stream_protocol::iostream under Boost 1.36.0
From: Jason Bertschi (jbertschi_at_[hidden])
Date: 2008-09-15 09:45:29


I was inferring what to pass in by the examples of tcp::iostream. I'm
assuming that the input parameters for the constructor are the same
parameters as for the 'connect' method (which, according to the
documentation, are used to construct a resolver query object). I
combined this with the examples of using stream_protocol::socket (in
examples/local/stream_client.cpp and stream_server.cpp) and figured I
could supply either a file name or an endpoint. I also tried suppling
no parameters (with the intent of doing a connect afterwards) and got
the same error about resolver_query being missing.

Alex Adranghi wrote:
> Hi,
>
> I also had the same error, and as a result switched to using the
> underlying api. According to the references there is no implementation
> for resolver query for local sockets. I didnt trawl through the source
> to check though. Also where did you find out what to pass to the
> stream_protocol's constructor?
>
>
>
> Jason Bertschi wrote:
>
>> I'm trying to use asio::local::stream_protocol::iostream to connect to a
>> server (using Boost library version 1.36.0). The code looks something
>> like this:
>>
>> boost::asio::local::stream_protocol::iostream
>> mgmtStream("/tmp/pipes/mgmtsock");
>> if (!mgmtStream) throw std::exception();
>> // Send cmd to mgmt
>> mgmtStream << cmd << std::flush;
>>
>>
>> I get a compilation error on the line creating mgmtStream. The
>> interesting part is this:
>> no type named 'resolver_query' in 'class
>> boost::asio::local::stream_protocol'
>>
>> I tried breaking the creation into two steps (create
>> local::stream_protocol::endpoint with the name of the socket then
>> passing the endpoint into the iostream constructor), but the result was
>> about the same (the failure occurred on the line creating the iostream,
>> not the line creating the endpoint).
>>
>> The problem seems to be that basic_socket_streambuf<stream_protocol>
>> requires the definition of type resolver_query (within stream_protocol
>> in this case). It seems that ip::tcp::iostream declares it to be of
>> type ip::basic_resolver_query<tcp>; I saw no obvious equivalent in the
>> local namespace, and my attempt to add 'typedef
>> ip::basic_resolver_query<stream_protocol> resolver_query;' to
>> stream_protocol of course did nothing helpful (just added a lot more
>> compilation errors). Frankly, I'm not sure how
>> stream_protocol::iostream could possibly compile without this definition
>> somewhere...
>>
>> Any ideas?
>>
>> Below is the full output from g++ (in case there's something helpful):
>> export_Darwin_i386/include/boost/asio/basic_socket_streambuf.hpp: In
>> instantiation of
>> 'boost::asio::basic_socket_streambuf<boost::asio::local::stream_protocol,
>> boost::asio::stream_socket_service<boost::asio::local::stream_protocol> >':
>> export_Darwin_i386/include/boost/utility/base_from_member.hpp:69:
>> instantiated from
>> 'boost::base_from_member<boost::asio::basic_socket_streambuf<boost::asio::local::stream_protocol,
>> boost::asio::stream_socket_service<boost::asio::local::stream_protocol>
>>
>>> , 0>'
>>>
>> export_Darwin_i386/include/boost/asio/basic_socket_iostream.hpp:86:
>> instantiated from
>> 'boost::asio::basic_socket_iostream<boost::asio::local::stream_protocol,
>> boost::asio::stream_socket_service<boost::asio::local::stream_protocol> >'
>> build_Darwin_i386/confdb/ObjectManager.cc:461: instantiated from here
>> export_Darwin_i386/include/boost/asio/basic_socket_streambuf.hpp:252:
>> error: no type named 'resolver_query' in 'class
>> boost::asio::local::stream_protocol'
>> export_Darwin_i386/include/boost/asio/basic_socket_streambuf.hpp: In
>> member function 'boost::asio::basic_socket_streambuf<Protocol,
>> StreamSocketService>* boost::asio::basic_socket_streambuf<Protocol,
>> StreamSocketService>::connect(T0) [with T0 = const char*, Protocol =
>> boost::asio::local::stream_protocol, StreamSocketService =
>> boost::asio::stream_socket_service<boost::asio::local::stream_protocol>]':
>> export_Darwin_i386/include/boost/asio/basic_socket_iostream.hpp:106:
>> instantiated from 'boost::asio::basic_socket_iostream<Protocol,
>> StreamSocketService>::basic_socket_iostream(T0) [with T0 = const char*,
>> Protocol = boost::asio::local::stream_protocol, StreamSocketService =
>> boost::asio::stream_socket_service<boost::asio::local::stream_protocol>]'
>> build_Darwin_i386/confdb/ObjectManager.cc:461: instantiated from here
>> export_Darwin_i386/include/boost/asio/basic_socket_streambuf.hpp:131:
>> error: no type named 'resolver_query' in 'class
>> boost::asio::local::stream_protocol'
>> export_Darwin_i386/include/boost/asio/basic_socket_streambuf.hpp:131:
>> error: no type named 'resolver_query' in 'class
>> boost::asio::local::stream_protocol'
>> export_Darwin_i386/include/boost/asio/basic_socket_streambuf.hpp:131:
>> error: no type named 'resolver_query' in 'class
>> boost::asio::local::stream_protocol'
>> export_Darwin_i386/include/boost/asio/basic_socket_streambuf.hpp:131:
>> error: 'resolve_and_connect' was not declared in this scope
>>
>>
>> Thanks,
>> Jason Bertschi
>> jbertschi_at_[hidden]
>>


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net