lua-users home
lua-l archive

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


On 04/24/2013 07:15 AM, Rena wrote:
> Actually, that still doesn't make it perfectly clear how *a should
> work with UDP, since the peer itself might split its message into
> several pieces. It seems like blindly reading until the socket is
> closed in this situation would be a great way to let other peers
> interfere with the transmission...

In this situation one should seriously consider TCP, which was created
for exactly this purpose.  If the application is splitting the logical
message into several physical messages for transmission as UDP, in
addition to the packet-injection problem you've mentioned, the packets
may arrive out of order, or only some of them may arrive at all.  The
issues of acknowledgement and retransmission are hard enough without
packet-reordering too, and TCP takes care of all of that, typically in
the kernel.

TCP is also vulnerable to packet-injection attacks, but less so than
UDP; but any protocol that attempts to truly protect the integrity of
messages needs to use a solid cryptographic message authentication
protocol which is typically (e.g. TLS) separate from the underlying
transport protocol, although there is an attempt to get momentum behind
a combined transport and security protocol [1].

Since you're writing a general-purpose socket library, you can probably
just ignore these issues and leave them to the application programmer
above you or the system programmer below you.

So, what I'm saying is that it isn't very important what meaning you
assign to "*a" because it would rarely if ever be useful anyhow.  UDP
can be useful for some multiple-packet applications (e.g. streaming
media) but I don't think that "*a" is going to make sense in those cases
either.

-- David

[1]: http://tcpcrypt.org/