Communicating with Datagram Sockets
Communicating using datagram sockets is simpler than using the TCP-based sockets (Socket and ServerSocket) that you used for the TServer. Communication is also faster because no connection overhead exists. There is also no attempt to send packets again if an error occurs, and there's no concern with sequencing multiple packets, as occurs in TCP/IP transmissions.
A datagram packet is sent as an array of bytes to a receiving program, presumably listening at a particular IP address and port. If the receiving program gets the datagram and wants to send a reply, it becomes the sender, addressing a datagram back to a known IP address and port. The conversation style is a bit like those two-way radios in airplanes ...
Get Platinum Edition Using XHTML™, XML, and Java™ 2 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.