How two servers communicate with each other

All computers connected to networks have different IP addresses. This is how networks can verify where particular messages should go. In order to connect different computers, you need to access one computer from another using a communication protocol or through a router table. Windows computers have the commands necessary to connect two computers with different IP addresses through a routing table, which can make setting up a network for your company's office easier.

  1. Log in to the first computer.

  2. Open a DOS prompt on the first computer by clicking the "Start" button and entering "cmd" into the search bar. Select the "cmd" option that appears in the search results to open a DOS prompt.

  3. Type the following command in the prompt on the first computer, press "Enter" and write down the entry that appears underneath the "network" column of the resulting table:

    netstat -nr

  4. Enter the following command into the first computer to create the network routing connection. The first IP address, 192.168.1.102, represents the IP address of the second computer to connect to, and will vary. The second IP address, 192.168.1.255, represents the value you copied in Step 3 from the "network" column:

    route add -host 192.168.1.102 gw 192.168.1.255 wlan0

I'm building an web app (Server A) that communicates with a remote server (Server B) that is connected to the internet.

Server B resides behind a NAT and is listening to communication on 3 non-standard ports.

In a typical scenario, in order for me to deploy multiple remote servers across different networks and to have it communicate with the parent web app (Server A), each of these servers have to have the routers manually configured to forward the respective ports to a static ip in which Server B is configured.

I'm looking for a way to solve this problem of having to configure each router individually and manually for each deployment. Port forwarding has to be done because Server A has to communicate with Server B and has to initiate the conversation.

I'm asking if there's a way for Server B to initiate the communication rather than the other way round so that port forwarding doesn't need to occur.

Server B would just need to call home, open up what ever sockets/ports necessarily (this is where I need your help for information) and all communication would be done via these opened ports without Server A ever needing to know the ip of Server B, and having to talk to the router to handle the forwarding.

Is this scenario possible?

Edit: Added some more details:

Basically I have created a webapp (Server A) that talks to multiple 3D print servers that has an REST API exposed. The print server API servers are all listening on a non-standard port of 8721.

Right now, manually on my webapp I am configuring manually to point to each print server via their external ip address and port-forwarded port. As you can probably tell this is going to create a shitload of problems as most of these external ip addresses are going to change due to most home/consumer networks not having a static ip.

This means that I have to find out everytime the ip address is changed and manually modify my records on my webapp.

I imagine (and hypothesize) that one of the best way to solve this is to not let the webapp worry about where each of these print servers are located but rather let the print servers themselves tell the webserver where they are.

I'm trying to solve 2 problems:

  1. The external ip addresses being dynamic and not static (as mentioned above)
  2. Port-forwarding/firewall imposed by the home networks. In the event that there are multiple print servers in a home network, this means that in order to reach each server individually, the home router needs to know how to route each unique port which needs to be configured on both the webapp and the home router side to the right print server (as all of them are listening on 8721).

Sorry for the lengthy post. I', still relatively new to the whole socket programming part of things and I'm hoping that someone would be able to point me to where I should be looking to find out more information on how to do the above.

Web browsers like Microsoft Edge, Firefox, Chrome, and Safari rank among the most popular network applications in the world. People use these browsers for basic information browsing and other needs, including online shopping and casual gaming. Web server communication relies on network protocols.

Web servers are what supply the content for web browsers. What the browser requests, the server delivers through internet network connections.

Web browsers and web servers function together as a client-server system. In computer networking, client-server is a standard method for designing applications where data is kept in central locations (server computers) and efficiently shared with any number of other computers (the clients) on request. All web browsers function as clients that request information from websites (servers).

Numerous web browser clients can request data from the same website. Requests can happen at all different times or simultaneously. Client-server systems conceptually call for all requests to the same site to be handled by one server. In practice, however, because the volume of requests to web servers can sometimes grow very large, web servers are often built as a distributed pool of server computers.

For websites popular in different countries around the world, this webserver pool is geographically distributed to help improve the response time to browsers. If the server is closer to the requesting device, the time it takes to deliver the content is faster than if the server were further away.

Web browsers and servers communicate using TCP/IP. Hypertext Transfer Protocol is the standard application protocol on top of TCP/IP supporting web browser requests and server responses.

Web browsers also rely on DNS to work with URLs. These protocol standards enable different brands of web browsers to communicate with different brands of web servers without requiring particular logic for each combination.

Like most internet traffic, web browser and server connections typically run through a series of intermediate network routers.

A basic web browsing session works like this:

  • A person specifies a URL in a browser.
  • The browser initiates a TCP connection to the server or server pool (using port 80, by default) through its IP address, as published in DNS. As part of this process, the browser also makes DNS lookup requests to convert the URL to an IP address.
  • After the server completes the acknowledgment of its side of the TCP connection, the browser sends HTTP requests to the server to retrieve the content.
  • After the server replies with content for the page, the browser retrieves it from the HTTP packets and displays it accordingly. Content can include embedded URLs for advertising banners or other external content, which in turn triggers the browser to issue new TCP connection requests to those locations. The browser may also save temporary information, called cookies, about its connections to local files on the client computer.
  • Any errors encountered during the request for the content might appear as HTTP status lines.

Thanks for letting us know!

Subscribe

Tell us why!

ELI5: How do servers talk to each other? from explainlikeimfive

Host Integration Server computers communicate with each other using mail slot or datagram broadcast messages. They use the SnaBase service to keep track of names of servers, client computers, and available transaction programs (TPs), which are the programs used for communication through Advanced Program-to-Program Communications (APPC) or Common Programming Interface for Communications (CPI-C).

Windows operating systems support multiple protocols simultaneously, but there is no need to send the same Host Integration Server broadcasts over all available protocols. Using the SNA Manager Console, you can specify the network protocol for server broadcasts. You must make sure that one protocol is available on all Host Integration Server computers in the SNA subdomain, and use that protocol for server broadcasts. For more information, see Configuring a Server Broadcast. The following figure shows a network in which TCP/IP is used for server-to-server communications and TCP/IP is used for client-to-server communications.

How two servers communicate with each other

Using different protocols for server-to-server and client-to-server communications

Separate protocol used for server-to-server and client-to-server communications

It is recommended that you use only one protocol for server broadcasts. Using multiple server-to-server transport protocols can add to network overhead because every server broadcast must be sent out through all the protocols selected.

Server broadcasts need to be configured only once for a subdomain; the configuration affects all servers in the subdomain.

The mean time between server broadcasts is specified in number of seconds, with the default being 60 seconds. Specifying a smaller value brings heavier demands on the network because the broadcasts occur more often.

In this Section

Configuring a Server Broadcast

See Also

SNA Service