Socket programming is a way of connecting two nodes on a network to communicate with each other. One socket (node) listens on a particular port at an IP, while other socket reaches out to the other in order to form a connection.
The server forms the listener socket while the client reaches out to the server. Socket and Server Socket classes are used for connection-oriented socket programming.
If you wish to know more about Socket Programming, you can refer to this below article
https://www.edureka.co/blog/socket-programming-in-java/