Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Sockets communication between Internal and external IPs

Sockets communication between Internal and external IPs

Scheduled Pinned Locked Moved C / C++ / MFC
questionsysadminlounge
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    namithakathi
    wrote on last edited by
    #1

    hi i am newbie... i am a bit confused in socket programming. my question is.. how can we communicate thru sockets between two different Ips as these two ip are have their internal IP and external IPs. suppose that communication shud be between A and B.and A and B are having their internal and external IPs. 1. how the server(A) shud listen (ok it will listen to port x)?.if the client(B) connect to external IP of A..will that each to the server A? 2.if server (A) sends a message to Client (B) on B`s external IP will that reach the client B? any one please pull me out of this confusion . plz point out if i am wrong or suggetst me how can i wright socket application ( chat for examaple) between these two IPs those of each are having two IP`( internal and external). --Thanks in advance.:)

    hi

    K M 2 Replies Last reply
    0
    • N namithakathi

      hi i am newbie... i am a bit confused in socket programming. my question is.. how can we communicate thru sockets between two different Ips as these two ip are have their internal IP and external IPs. suppose that communication shud be between A and B.and A and B are having their internal and external IPs. 1. how the server(A) shud listen (ok it will listen to port x)?.if the client(B) connect to external IP of A..will that each to the server A? 2.if server (A) sends a message to Client (B) on B`s external IP will that reach the client B? any one please pull me out of this confusion . plz point out if i am wrong or suggetst me how can i wright socket application ( chat for examaple) between these two IPs those of each are having two IP`( internal and external). --Thanks in advance.:)

      hi

      K Offline
      K Offline
      kasturi_haribabu
      wrote on last edited by
      #2

      A Socket needs an IPAddress to communicate with its another peer. 1. It doesnt care whether it is External (PublicIP) or Internal (LAN)(hope my interpretation of internal and external is right) it is handled by the DNSserver (publicIP) or your LAN GateWay. 2. Once the Connect--listen-- accept sequence is over, you can exchange messages between any two connected sockets. regards, haribabu

      1 Reply Last reply
      0
      • N namithakathi

        hi i am newbie... i am a bit confused in socket programming. my question is.. how can we communicate thru sockets between two different Ips as these two ip are have their internal IP and external IPs. suppose that communication shud be between A and B.and A and B are having their internal and external IPs. 1. how the server(A) shud listen (ok it will listen to port x)?.if the client(B) connect to external IP of A..will that each to the server A? 2.if server (A) sends a message to Client (B) on B`s external IP will that reach the client B? any one please pull me out of this confusion . plz point out if i am wrong or suggetst me how can i wright socket application ( chat for examaple) between these two IPs those of each are having two IP`( internal and external). --Thanks in advance.:)

        hi

        M Offline
        M Offline
        Moak
        wrote on last edited by
        #3

        namithakathi wrote:

        how can we communicate thru sockets between two different Ips as these two ip are have their internal IP and external IPs.

        Let's start inside the LAN, here your two peers communicate using the internal LAN IP addresses. It gets a little bit more difficult when you communicate outside the LAN and the internet IP address (external IP address) is different to the LAN IP address (internal IP address). Generally two peers on the internet have to communicate via their external IP adresses, typically the router or the proxy does a kind of network-address-translation for you. For example if your internal IP address is 192.168.1.1 it could from the outside look like as you would have an external IP address 87.164.52.42. This network-address-translation often works automaticaly for the outgoing traffic (depends on your network setup), but it usually does not work automatically for incoming traffic (internet to LAN).... aka "firewalled computer". Hope this helps for a start.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups