1) "Unknown transfer id" message was because the local variable "tid"
is not a transfer id, it is a sequence number - so the check was
actually comparing expected vs actual acknowledged sequence number,
not TID. It's still a problem if we get the wrong one, but it
indicates a lost packet (so we should resend) not a packet that was
sent from somewhere else.
2) if the ACK packet has not been received, our retry should involve
_resending_ it, not just trying to wait for it again.
3) I have removed the timeout condition for terminating the resend
loop, because in practice (assuming both ends have the same timeout
setting) all it did was ensure that the loop only ran once. The
timeout is supposed to regulate how long we wait for before retrying
(it doesn't do this, we wait indefinitely), not how long we wait for
before giving up.
this is due to a rather odd (imo) decision in luasocket which
says that the underlying socket (and therefore its file
descriptor) isn't actually created until we call something
that lets it work out whether ipv4 or ipv6