the event triggers twice because you didn't read all the data from the receive buffer the first time: $sock().rq would probably reveal that there is more information to read. i say 'probably' because if you try this test many times, you're bound to get 'correct' results at least some of the time.
I did read all the data, try it because I did test this many times, and the bug occurs 100% of the time.
as drum said, it's just the way UDP works :P you can't guarantee that the data in the receive buffer came from multiple sources at the mIRC level, and i don't think it can be done seamlessly at the C level either (if we assume that the application polls the system for new incoming data - the two datagrams you send may be received by the system in between polls).
No it's not how udp work, thanks god in C you can accuratly get the source ip and port.
you could have the clients encode all details that could potentially be lost as the first few bytes of every message.
??
mIRC *is* actually sending the packets on separate ports. The problem is indeed that the sockread event is tripping over itself.
Yep, must be
related