tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: datagram vs stream sockets



>> A limited form of this could be achieved by wrapping read and write
>> with something that puts framing bytes around records so as to
>> preserve record boundaries through an underlying transport (AF_LOCAL
>> SOCK_STREAM) that does not inherently do so.  But it would be
>> difficult to make that work without breaking other uses of read and
>> write in the same code.
> If you wrap open (or do something specific when the file is opened)
> the code that intercepts read/write can know the fd number on which
> it must add/remove the headers....

You either have to wrap a bunch of other calls too (dup, dup2, and
recvmsg come to mind offhand; there are likely others), or you have
something brittle, liable to break in surprising and disconcerting ways
because of the hidden state: you're imposing restrictions on the API
that aren't there in other implementations.

/~\ The ASCII                             Mouse
\ / Ribbon Campaign
 X  Against HTML                mouse%rodents-montreal.org@localhost
/ \ Email!           7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


Home | Main Index | Thread Index | Old Index