Some time ago I made another communication software in Java-shanzhai zookeeper. Generally, this simple chat software is called a LAN chat tool, so can it implement Internet access to the Intranet for communication? This problem has been lingering for a long time in my mind.
In the past, two simple clients used to communicate directly without passing through the server. Therefore, it is really hard to think about how to access machines in the other Intranet from one Intranet (maybe is limited ). However, this Java implementation uses a server to complete client communication. can I access the Internet from an intranet and then from the Internet to the Intranet?
First, let's take a look at the figure where the software communicates within the LAN:
In this way, the client sends a message to the server, and then the server forwards the message to the specified client. the client and the server belong to the same LAN, so there is no problem in understanding. The socket is the core of message forwarding. It should be noted that if all the clients here are Internet addresses, they can also communicate, because they are directly connected.
Then let's take a look at the communication via the Internet:
In this way, intranet user a first logs on to the server, so that a socket connection is established on the server, and the Internet will send messages through this socket each time the communication is conducted. In this way, the Internet and Intranet communicate directly, and the core is socket. (Personal understanding)
Many people posted posts on the Internet asking how QQ communication was conducted. Some people replied that they had found the route table, the address, and some other answers, but I did not know that it was correct.
In conclusion, the focus is actually on the socket. I do not know what the socket actually contains, so the above articles all come from my own assumptions.