Hi Peter,
I really like the idea! It would be a big unloading for our transfer sessions because of the reasons you’ve written.
Now the interesting part is that the very same approach could be used for HTTP – we only need to suitably split HTTP messages in “packets” (though I think a more abstract Data would be better). For example HttpData would be HttpHeader (HttpRequestHeader, HttpResponseHeader), HttpBodyChunk. Now if we consider each a kind of Packet, then we could reuse the same PacketSession. Because PacketSession is so generic, I think we should better call it just Session. Then we could also define an abstract base class Data that Packet will derive from. We could also think of a generalization Message for text-based messages (like HTTP headers or XML messages) that also derives from Data.
I agree that we should define an abstract base class Data, because it will be more abstract than a packet and could be used for other (”not-so-packet-like”) data (e.g. http messages). Similarly, I agree that we should rename PacketSession into Session. The idea with the generalized Message class is also nice!
Petr
