Connect Client Machine Remotely over the Internet

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • syed anwar
    New Member
    • Feb 2007
    • 5

    #1

    Connect Client Machine Remotely over the Internet

    I just develop a simple 2 apps related with socket.
    one is server and one is client. they are working fine in a LAN but i want that if my 2 apps is running in two different machine and there is no
    lan connection, only internet connection is available then how two apps can interact with each by through socket programming other internet.

    suppose there is two machine in two different office and there is no connection between two machine but both the machine can access internet.
    in this type of situation how socket client can communicate with socket server which running in different office and internet is available in
    2 different office.because we know socket server run on a port and wait for incoming connection and socket client will connect to socket server
    through IP of that machine where socket server is running. but my situation we can provide IP address if both are member of same network/LAN but here i
    told you that there is no connection between two machine where socket server & client is running. in this case what IP address i need to give to socket client to connect to socket server. i have no idea about this but i search google and found some scratch idea that this type of situation can be handle
    through WAN IP. so please tell me is it right concept or not. if right then how socket client will know that what is the wan IP of that machine where socket server is running or suppose if i know the wan IP of that machine where socket server is running then can my socket client can communicate with
    socket server just by WAN IP.

    so please someone give me the idea in detail as a result i can handle this situation and also will be able that to program in such way that socket client
    can communicate with socket server if there is no LAN connection but internet connection is available.

    please help me with idea and if possible give me a sample code
    Last edited by Frinavale; Apr 27 '10, 03:20 PM. Reason: Moved from ASP.NET to networking
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    I'm not very good with network stuff but I recommend that you look into using a Domain Name instead of directly specifying the IP of the server computer.

    -Frinny

    Comment

    • Banfa
      Recognized Expert Expert
      • Feb 2006
      • 9067

      #3
      DNS is not the solution although it may be part of the solution if your company has its own DNS server. The solution to this problem is in the company firewall of the site hosting the server.

      The firewall/router is the interface between your LAN and the WAN (internet). Anything outside the LAN only has access to the external side of the firewall/router and can only connect to its external (WAN) address. What you basically need to do is set-up a path through the firewall/router that will route external traffic onto you server on the internal LAN.

      This is normally relatively simple, especially for the person managing the firewall/router who knows how it works. They set-up a firewall/router rule that anything connecting to a specific WAN address and port is forwarded to a specific LAN address and port. You make the LAN address and port the address of your server.

      Then your client can connect to your server by connecting to the configured WAN address and port that has been set-up in the router/firewall to forward to your server.

      I have been trying to find a diagram with IP address of a LAN/WAN connection through a router that makes thiis a little clearer but have been unable to.


      Another option, if the firewalls of your 2 sites permit it is to set up a VPN. This effectively sets up and encrypted tunnel through the internet that links the 2 sites LANs into a single LAN. You client should then be able to connect directly using the LAN address of the server. However VPNs are rarely simple to set-up.

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32669

        #4
        Unless you're talking about internet servers, devices which have internet accessible IP addresses, this is not straightforward . Most of the world has been working hard to ensure this sort of thing is heavily restricted as it is a concept that would make life very easy for writers of malware. Hence it is that most PCs, even internet servers, are secured behind firewalls and are only addressable where absolutely necessary.

        The good news is that there are ways to enable devices to communicate across the internet in a fashion almost identical to the situation where they share the same secure local network. This is not done within the software though. This would be configured by network specialists to enable disparate devices, and sometimes even networks, to communicate in such a way.

        I suggest you speak with whomever it is that is responsible for your networks to see how best this can be set up for you.

        Comment

        • Frinavale
          Recognized Expert Expert
          • Oct 2006
          • 9749

          #5
          Thanks guys :)
          Now that I'm sure this is a networking question I've moved it to the networking forum :)

          -Frinny

          Comment

          Working...