External network, intranet, app to communicate with each other, message reverse send

Source: Internet
Author: User

Before doing the system has an application is, the app, extranet server, intranet service, intranet client communication messages, due to the design of the system, intranet services and extranet services are defined as Web servers, where the external network service side
and intranet server does not have a strict definition can be arbitrarily replaced with other, in our application of foreign Network Service is an external network of Web applications servers, intranet server is a networked intranet servers (multiple), intranet client is a non-networked local program (an intranet server under a number of), The app is a networking and extranet service-side communication and an application that communicates through WiFi networks and intranet services (where WiFi traffic is omitted), and the process of message communication is App users based on the current latitude and longitude from the extranet server to get to the current location near the intranet server collection (each intranet server can find the latitude and longitude address in the external network), and then the app to select an intranet service side, and send a message to the extranet service, The content of the message is the user's own information and the identity symbol of the Intranet service side, and then the extranet service side according to the content of the message sent by the intranet server identifier, the app user's information sent to the designated intranet service side, the intranet server received information after the app user's information cached. So that the app arrives at the intranet server location point, the intranet client through its trigger way to start verification, in the validation of the cache information to do check, of course, which involves some other details, session cache, heartbeat failure, intranet server information cache, intranet multi-client, etc., here is not detailed. Restriction 1 is the external network server does not know the actual address of the intranet client.


In the design of the implementation of a number of ideas, first outside the Network service and intranet server communication, because do not know the address of the intranet, but know the address of the external network server, so the use of socket, the way to apply a ready frame mina,
By the Intranet service side at the time of launch, carry a own identifier (this identifier is already registered in the system of the external network server, can find corresponding relevant information, in order to correspond with the logo symbol that the app brings over), go to the active link service side, here involves some link time-out the invalidation is not detailed, Then the extranet server receives the connection from the intranet server and caches the link, and the cached information includes (session itself, symbol, connection timestamp, active state, last active heartbeat timestamp) and so on. Such a simple session cache is saved. Then the next step is the extranet server waiting for the app to access, from the access to the app user's own information and intranet server identifier, and then from the previous saved socket session cache to find the corresponding session, if can be found to determine whether the active status of the network can be sent, and then send, If the corresponding session is not found is not registered services, do not do processing, after such a logic to write the message through the stream, and then return to the processing results, so that a simple process is completed.


The specific part of the implementation program is visible in the previous blog post (http://blog.csdn.net/u013614451/article/details/40711021)


It is about the validity of the service-end session of the intranet server and the monitoring of the network condition of all intranet service side, imitating the heartbeat mechanism,
See also Blog ()

External network, intranet, app to communicate with each other, message reverse send

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.