Both of them are good. It depends on task you do.
DatagramSocket is designed for UDP and ServerSocket for TCP. TCP is more reliable in terms that it ensures delivery, UDP not. But UDP packets are much smaller and have no such big headers like TCP packets have.
If it is smaller then there is more probability that it arrives faster. UDP used mostly in areas where you do no mind about retransmission. You just do not need this, because information become obsolete. Sound, for example.
It is better to make small pause or repeat last packet than to play some piece that was send first but received second.
It is up to you to take decision. If you do not mind that can lose small piece of data - use UDP. Otherwise use TCP.