Should I use ServerSocket or DatagramSocket in my applications?
DatagramSocket allows a server to accept UDP packets, whereas ServerSocket allows an application to accept TCP connections. It depends on the protocol you’re trying to implement. If you’re creating a new protocol, here’s a few tips • DatagramSockets communciate using UDP packets. These packets don’t guarantee delivery – you’ll need to handle missing packets in your client/server • ServerSockets communicate using TCP connections. TCP guarantees delivery, so all you need to do is have your applications read and write using a socket’s InputStream and OutputStream.