|
Boost : |
From: Brian Gray (briangray_at_[hidden])
Date: 2003-02-13 20:45:25
On Wednesday, February 12, 2003, at 03:11 PM, Jason House wrote:
> Once I heard there was a generic socket library in development, I
> thought I'd add
> a quick feature request. I would like to see the ability to have
> multiple
> streams through the same socket.
This is pseudo-doable over TCP, by encoding the logical stream into the
TCP stream. Unfortunately, a lot of what is done with multiple TCP
streams is done that way to keep each stream distinct and keep a single
lost packet in one stream from holding up other streams during
retransmission. If you don't care about the lag, it's just a matter of
your application-level protocol encoding the stream ID.
If you really want separate, reliable, synchronized streams over a
single connection, you'll need a new transmission-level protocol. It
would be built on top of UDP (unless you have the clout to get all
popular operating systems to ship with your protocol), and that's just
a whole big can of worms you don't want to open. Still, if you can't
resist, try reading through W. Richard Stevens' _TCP/IP Illustrated,
Volume 2_. It walks you through the BSD implementation and can help
you code your new protocol, either on top of TCP or over raw IP
packets. Also, you can get lots of good tips by reading the Linux IP
stacks, though I wouldn't recommend the Coriolis commentary book.
If all you're concerned with is the server knowing what client is
connecting, just have a handshake on each connection, authorizing the
stream. Maybe the first stream can carry a code #, server to client,
that the client must subsequently use when establishing subsequent
connections. It all depends on how secure you intend to be, but at
this point it's out of the scope of a Boost sockets implementation.
-- Brian
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk