[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: LuaSocket and multiple UDP peers
- From: Rena <hyperhacker@...>
- Date: Tue, 23 Apr 2013 19:23:32 -0400
If I'm understanding the documentation of recvfrom() correctly, a UDP listening socket can receive packets from any peer, and recvfrom() will return the packet plus the address and port it was received from. That suggests to me that it's possible to receive a long message from peer A, which arrives in two separate packets, and in between them arrives a packet from peer B.
I've been writing a socket library myself and want to support the same functionality as LuaSocket, in which receive() accepts patterns *l and *a. However I'm not sure what to do about this possibility, nor what LuaSocket does if you specify *a and receive messages from multiple peers. Does it just concat them all together disregarding the source information? Or am I misunderstanding how UDP sockets work?
Sent from my Game Boy.