What is the difference between Socket and ServerSocket?

前端 未结 9 1624
遇见更好的自我
遇见更好的自我 2021-02-01 02:10

If Socket represents client side and ServerSocket represents server side, why Socket.read reads the data from server side? I\'m really con

9条回答
  •  忘掉有多难
    2021-02-01 02:25

    java.net.ServerSocket

    This class implements server sockets. A server socket waits for requests to come in over the network. It performs some operation based on that request, and then possibly returns a result to the requester.

    java.net.Socket

    This class implements client sockets (also called just "sockets"). A socket is an endpoint for communication between two machines.

提交回复
热议问题