Home > Articles > Programming > Java

  • Print
  • + Share This
This chapter is from the book

6.3 TCP Sockets and Java

Java offers good support for TCP sockets, in the form of two socket classes, java.net.Socket and java.net.ServerSocket. When writing client software that connects to an existing service, the Socket class should be used. When writing server software that binds to a local port in order to provide a service, the ServerSocket class should be employed. This is different from the way a DatagramSocket works with UDP—the function of connecting to servers, and the function of accepting data from clients, is split into a separate class under TCP.

  • + Share This
  • 🔖 Save To Your Account