|
Boost : |
From: Don G (dongryphon_at_[hidden])
Date: 2005-04-24 18:32:54
Hi Peter,
>>> This of course leads to the obvious question:
>>> which network gives me a stream over COM1?
>>
>> network_ptr com1 =
>> new net_over_stream(
>> new stream_over_serial("com1"));
>
> Wait a minute. Which network creates the
> stream_over_serial? Assume that I don't need
> the outer network since I'll be communicating
> with a printer, for example.
Serves me right for being glib. :)
Here's what I meant:
class stream_over_serial : public net::stream
{
public:
stream_over_serial (string comport);
};
This is a net::stream impl over the named COM device. On Windows,
this might use lineOpen.
Now that we have a stream, we wrap it in a network:
class network_over_stream : public net::network
{
public:
network_over_stream (net::stream_ptr strm);
};
The caller of all this is whom so ever wanted a network running over
the COM port. (glib again, I know<g> but this is just a sketch).
FWIW: We use host names like "g" and "h" for "guest" and "host" where
the "guest" is the initiator/active open and "host" is the
acceptor/passive open. The new_local_address() would return "g" as a
physical address on the side that did the above.
> My point was that different network objects can
> interpret the same address to mean different
> things, at least in theory. URIs are supposed to
> be context-independent.
I see your point. Your suggestion of encoding the network as part of
the URI would solve this. That could be a global map/table or a
multi-net impl of net::network (one that was a net::network and
wrapped a collection of network's; not that I want to go there<g>).
But, these schemes would still compete with the set defined for the
Internet (the http:// form should work since it is universal).
The issue was that I wanted user visible addresses to be familiar
(such as the now infamous "http://www.boost.org"). Given that desire,
and the fact that our most heavily used network impl was TCP/IP, I
had no problem with this level of abuse. ;)
Also, the same protocol can run over multiple nets, so "foo://G" or
"foo://10.0.0.7" just made some (twisted<g>) sense to me and I never
worried about the ambiguity.
Do you see this as an acceptable abuse, or as doing violence to the
RFC? :)
Best,
Don
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk