From: Donal K. F. <don...@ma...> - 2008-12-08 03:32:51
|
Alexandre Ferrieux wrote: > Can you elaborate ? > Is there a fundamental difference between sending a data packet in > point-to-point mode over USB, Bluetooth, or IP(UDP) for that matter ? > > By this I mean, I acknowledge the slight mismatch between the > stream-like Tcl channel model and packetized transmissions, but it is > doable anyway, as is shown by TclUDP: [puts -nonewline] (below the > MTU) and short-[read]s are just a peculiar packet interface, but a > working one... That's the really big issue. With channels, it doesn't really matter if you break a message up into pieces: the other side will get them in order and can reassemble. With message-oriented connections such as UDP[*] that assumption doesn't hold, so TclUDP can break "interestingly" if used naïvely with large messages. The way to fix this is to use a better fundamental model of message-oriented communications for those types of connections, but nobody's done one for us yet. (In short, TclUDP does it "the wrong way" for the _excellent_ reason that "the right way" isn't defined yet.) We ought to fix that, but that's a pretty big project. Apart from that, there's not much fundamental difference between the different types of sockets and, of course, to date Tcl's been good at hiding those differences which exist. We'd be able to reuse important things like the Notifier, so in fact most of the key bits already exist. Oh, and the other key thing: if we're doing the introduction of this whole new API right, we should remember to allow Tcl-implemented message layers. (Someone might be odd enough to layer email/SMTP or XMPP or SOAP over it. Crazy, but who am I to say no? :-D) Donal. [* Anything that's SOCK_DGRAM in David's table. And I don't understand SOCK_SEQPACKET. ] |