Header Ads

  • Breaking Now

    What should I use a ServerSocket or DatagramSocket in my applications?

    DatagramSocket accepts only UDP packets, whereas ServerSocket allows TCP connections in an application. It depends on the protocol one implements. Here are few things which one should keep in mind while implementing a new protocol:

    -UDP is not a reliable protocol as you may loose data packets over the network so while coding you will have to handle missing packets in your client/server.

    -ServerSockets use TCP connections for communication.TCP is safe and reliable protocol and guarantees delivery, all you need is InputStream to read and OutputStream to write over TCP.

    Post Top Ad

    Post Bottom Ad