473,889 Members | 1,327 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

2 computers on same network connectnig to each other via internet

18 New Member
I have written an application that runs in a kind of peer-to-peer framework. Servers connect to a masterserver, which a client then queries to receive a list of servers. The client selects a server and connects to that server directly and both the server and client sever their connections with the masterserver.

Problem: I have the masterserver set up at a location and it is not behind a router or firewall or anything, just directly connected to the internet. I have in a separate location (separate internet connection, too) a server and a client computer on the same network. Both can connect to the masterserver fine. A TCP connection is maintained with clients whilst UDP packets are sent out periodically to both clients and servers. The TCP connection is fine and the UDP packets are always received by the same computer, and always not received by the other one (regardless of which one is the server and which one is the client). When the direct (TCP) connection between the client and server is attempted, however, it doesn't work: "Connection forcefully refused" error message. The standard ports that the application uses are opened for both TCP and UDP on the router. My thoughts are that whilst these ports are set to forward to both computers in the router setup, only one computer receives the UDP packets sent out by the MS and so I'm wondering if the perhaps only one computer is receiving the TCP packets necessary to establish a connection as well.

Notes: If I run the masterserver on the network behind the router and try to connect to it (as either server or client) from the computer directly connected to the internet the connection is fine (I haven't tested the server-client connection from computers on different networks yet). When the masterserver is run on the same network as the server and client and a local address (192.168.x.x) is used for the masterserver everything works perfectly. In the same situation when a non-local IP is used neither computer can connect to the masterserver as either server or client.

I would really appreciate any help on this issue since the application is meant to support two computers on the same network connecting to each other via the external masterserver.


P.S. The router is Open Networks in case that helps.
Apr 3 '09
24 5840
18 New Member
I tried disabling the Windows firewall for all computers, but it makes no difference.
Apr 23 '09 #11
18 New Member
I just tried connecting to a server behind the router using an external computer and it works, so it only fails when the client is behind the same router as the server.
Apr 23 '09 #12
32,584 Recognized Expert Moderator MVP
That sounds very much like an answer to my post #2 (quoted) might be helpful. Please be very careful to get these details right, as they have been know to confuse people. If you need any help, just ask.
Apr 23 '09 #13
18 New Member
External IP: 118.208.x.x (the last two numbers change periodically)
Network IP:

I got these details by running ipconfig on each of the machines:
Network IP:
Subnet Mask:

Network IP:
Subnet Mask:
Apr 24 '09 #14
32,584 Recognized Expert Moderator MVP
Are there not 3 machines involved in this situation? The master server details seem to be missing (quite important info).
Apr 24 '09 #15
18 New Member
The master server IP is 114.76.x.x
Subnet mask:
It is just directly connected to the internet, no router/network.
Apr 27 '09 #16
32,584 Recognized Expert Moderator MVP
This seems to be saying the Master Server is physically located at a different location from the other two machines. That's fine, but can you say which IP address/Port combinations are returned when the request is made of the Master Server by the Client?

Also, how does the Server that's selected, get the IP address/Port combination of the Client?

You do appreciate I presume that the 192.168.1.x addresses are never known to the Master Server, so will never be used for the Server/Client communications?

PS. To proceed I will need answers to all questions. Leaving out any of the answers will only prolong the process.
Apr 27 '09 #17
18 New Member
The master server is located physically in a different location from the other two machines. I will explain again what takes place, by the time the error occurs, the master server is no longer part of the communication.

1) Master Server listens for TCP connections from clients and UDP packets from servers.

2) The server listens on a TCP port for a client connection and sends UDP packets to the Master Server. These packets contain information about which port the server is listening on that the client will need to connect to.

3) The client establishes a TCP connection to the Master Server.

4) The Master Server sends to the client a list of all the servers, including the server's IP and the port the server is listening on for a client connection.

5) The client selects from the list the server to which it wishes to connect.

6) The client terminates the connection to the Master Server.

7) The client extablishes a connection to the server using the IP/port combination received in step 4 from the Master Server.

8) The server accepts the connection and stops sending UDP packets to the Master Server.

The error occurs in step 7 if the client and server are behind the same router. It should be noted that the port on which the server is listening for a client TCP connection is forwarded by the router to the server.

See step 4.

The client connects to the server, so this is not explicitly needed, but is received when the connection is established.

Yes, I am aware of this.
Apr 28 '09 #18
32,584 Recognized Expert Moderator MVP
This is true, but it is nevertheless an important part of the equation.

Consider that the Server machine is passing an IP Address / Port combination. If this is all within the data of the packet then the IP Address part will reflect the internal (192.168.1.x) address rather than any external one (118.208.x.x). The data portion of packets are not changed by the router. Only the header info can be. If however, the data passed is simply the Port address (more likely I would expect as otherwise only locally connected devices could be made to work), then the IP Address would be taken from the packet header, which would be adjusted by the router in line with NAT. Essentially the internal 192.168.1.x address replaced by the 118.208.x.x one. The port, within the data, would remain unchanged.

Assuming for the moment that the router has been set up correctly to convert any external TCP/IP messages addressed to that (external) address with that port, through to the original (internal) Server IP address on the same port, then communication should be possible from external locations.

Now consider the situation you are in.

Your Client machine has the same information that any other clients on the internet would have (118.208.x.x:Po rt#). In this specific case though, the proper way to address the Server from the Client would be to use the internal address (192.168.1.x:Po rt#). Using the external address instead, the Client traffic is transferred to the router to handle. The router recognises its own external IP Address, so knows to handle it itself, but when it checks its rules to see if there is a mapping for that port, it's not looking for a rule handling that port from the external interface. It must check rules for the internal interface.

The chances are that this rule has not been configured for the internal interface at all, but is set up explicitly for the external one only. In that case, the router would throw a wobbly and complain with a "Connection forcefully refused" message. After all, the router itself is trying to handle the traffic for that port in this case.

Does that sound like it may explain your situation?
Apr 28 '09 #19
18 New Member
Yes, that sounds exactly like what's happening. I don't suppose you know how to set this up, I can't see anything resembling "internal interface" in my router's setup options and port forwarding only has a WAN connection option? Is it possible for a router not to have this functionality?
Apr 29 '09 #20

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Max M | last post by:
I am using ClientCookie for login on to servers and browsing them as authenticated users. I kept getting "HTTP Error 400: Bad Request" errors when submitting my forms. So I boiled it down to a simple example. When I try to use ClientCookie.urlopen() on my private network with ip numbers like "http://localhost:8081/test_site/logged_in", it works fine. If I try to call the same site through the Internet, with a url like:
by: Sandeep Arya | last post by:
Thanks linuxfreak and sybren for positive comments My application will be running on Linux. How to send ICMP ECHO as broadcast packets. I do not know this. Please tell me how to? Sybren.. Does nmap is available on every systems? I tried on my linux fc4 machine in user previleage. it was not working. Does this just belongs to superuser...
by: J Smith | last post by:
I'm making a website where each page has the same design, obviously its a bad idea to put the same code/html in each page so what is the best way to do this? What I'm doing at the moment is putting a file called 'index.php' and a file called 'content.php' in each directory. 'index.php' would set a variable called $content with the full path for 'content.php' then it would have an include() statement which called a script outside...
by: Steve | last post by:
Hi all How would i get a list of all Active Computers on a network? All I need are the computer names. Kind Regards, Steve.
by: dylpkls91 | last post by:
I have been researching this topic and come up with some code to make it work. It uses SSL and requires the 3rd party package Paramiko (which requires PyCrypto). However, at this moment I have no network to test the code on! Trying to connect to localhost ( fails. Before I buy network components, I want to be sure that this code will work. Will someone with two networked computers try it out for me? Thanks! Code: def...
by: brosner | last post by:
I installed MSSQL 2000 on my desktop (running NT 2000). No problem. I created an adp and attached it to a database within MSSQL 2000, no problem. When I go into MS Access, on another PC (running Windows XP Pro) on the same network, and try to create a using 'Project(Existing Data)' and connect it to MSSQL 2000 on my desktop, I fill in the Data Link Properties '1. Select or enter server name', no problem, '2. I click on Use Windows NT...
by: Vyas111111 | last post by:
Hello all I want to delete a file which is not placed on my local machine, it is placed on diffrent machine but in the same network. How can i delete that file , i am using VBScript -ASP Thanks in advanced
by: jellychai | last post by:
I'm doing the final year project that related to the SNMP. I need to find the solution for the IP auto detection in C#. When I run the main project, the program can automatically detect the IP for the agent and retrieve it's MIB, so that the user do not need to enter the IP address of the agent. Beside that, I also look for the solution that can detect the nodes that had switch on or switch off in C# coding. Wish can get the solution for these...
by: maheshgupta024 | last post by:
Im very new to PHP, and interseted in network stuff, using php can i enter into different computers from network within my LAN. Can anyone help on this.. Thanks in Advance
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.