> This is the first time I am writing a UDP server. The other UDP was a > client. It was fairly straight forward. > > As the server lets say I have 2 clients, A and B, that will be sending me > unsolicited data of 100 bytes per message. > > If I understand, when TWSocket.OnDataAvailable fires the data source can > be > mixed. > > For example I could get 10 bytes from A, then 19 bytes from B, then 14 > bytes > from B and then 56 bytes from A, etc. > And I might not get the hundred bytes. I might only get 45.
No, this is wrong. UDP is a datagram protocol. Datagram boundaries are respected. If you send 100 bytes (in one call to Send of course), you'll receive exactly 100 bytes in one call to Receive done from one OnDataAvailable event. There are a few things you must pay attention: TWSocket.BufSize must be large enough for your larger datagram (It default to 1460 bytes); when calling Receive or ReceiveFrom (to know who sent the packet), you must pass a bufer larger enough; not all physical networks are able to send any arbitrary large datagram. There is a limit imposed by each network. This is totally diffrent for TCP which is a stream protocol. For a complete description, see "TCP/UDP primer" document available from my website. -- [EMAIL PROTECTED] The author of the freeware multi-tier middleware MidWare The author of the freeware Internet Component Suite (ICS) http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be