A bit about socket-what about connecting the Internet to the Intranet?

Source: Internet
Author: User

 

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.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.