2 computers on same network connectnig to each other via internet

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Asja
    New Member
    • Feb 2009
    • 18

    #16
    The master server IP is 114.76.x.x
    Subnet mask: 255.255.240.0
    It is just directly connected to the internet, no router/network.

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32634

      #17
      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.

      Comment

      • Asja
        New Member
        • Feb 2009
        • 18

        #18
        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.

        Originally posted by NeoPa
        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?
        See step 4.

        Originally posted by NeoPa
        Also, how does the Server that's selected, get the IP address/Port combination of the Client?
        The client connects to the server, so this is not explicitly needed, but is received when the connection is established.

        Originally posted by NeoPa
        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?
        Yes, I am aware of this.

        Comment

        • NeoPa
          Recognized Expert Moderator MVP
          • Oct 2006
          • 32634

          #19
          Originally posted by Asja
          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.
          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?

          Comment

          • Asja
            New Member
            • Feb 2009
            • 18

            #20
            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?

            Comment

            • NeoPa
              Recognized Expert Moderator MVP
              • Oct 2006
              • 32634

              #21
              It depends on the router I think. My home routers have never had this facility.

              For testing, it may be necessary (although possibly complicated depending on your setup) to set up an alternative route to the internet for the different machines. That way they would use separate routers and the problem would not occur.

              Comment

              • Asja
                New Member
                • Feb 2009
                • 18

                #22
                Thanks for all your help NeoPa.

                Comment

                • NeoPa
                  Recognized Expert Moderator MVP
                  • Oct 2006
                  • 32634

                  #23
                  No worries Asja.

                  Did you manage to find a way past this?

                  Comment

                  • Asja
                    New Member
                    • Feb 2009
                    • 18

                    #24
                    No. But at least I know for sure now it's not a code problem. I guess whoever uses my software will just have to have their network set up appropriately if they wish to connect two computers behind the same router, and if this problem arises I may at least be able to point them in the right direction.

                    Comment

                    • NeoPa
                      Recognized Expert Moderator MVP
                      • Oct 2006
                      • 32634

                      #25
                      Ah 8-)

                      I'm glad it seems to have helped somewhat at least.

                      Comment

                      Working...