About Socket Communications

This section provides an overview of socket communications (Socket), which are often used in manufacturing machinery, real-time chat, video calls, and communication games.
Socket is an entry and exit point for TCP and UDP. Compared to general-purpose protocols (http/ftp, etc.), Socket enables communication control, more detailed log output, status management, constant connection, and communication capacity reduction.
It allows for the creation of more flexible communication applications.
On the other hand, to use TCP/IP “properly” you must be aware of TCP/IP transitions, and if you don’t understand the drawings that come up when you search for TCP/IP transition diagrams, you may need to read Mastering TCP/IP. Even if you are an application programmer, not a network engineer.
For example, Socket allows you to specify any port number you want, but if it conflicts with a port number used by the OS or another installed application, it could crash the OS in the worst case, or create an unintended security hole. Perhaps the application will not start or an error will occur.
The following figure shows a layered application for socket communication.

The following figure shows a layered application of socket communication.

There are many examples of code for socket communication in java and python that can be found by doing a google search, so I don’t think it’s that difficult.
However, I think you may encounter various troubles in implementation, such as a zombie daemon that somehow leaves a session that should have been closed.
I hope you will consider this.
For your reference.