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. Socket Connection Through Internet

Socket Connection Through Internet

Scheduled Pinned Locked Moved C / C++ / MFC
c++sysadmin
3 Posts 3 Posters 1 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.
  • S Offline
    S Offline
    shakumar_22
    wrote on last edited by
    #1

    Hi In my VC++ Socket programme I can connect to another system and transfer the data between them, the system are connected through LAN. I want to know how can communicate with another system through Internet by socket programme(with out LAN ,through Internet). (Like Server running in anywhere and client was Running anywhere they are connect through internet by Socket programme) Regards shakumar

    shakumar

    J G 2 Replies Last reply
    0
    • S shakumar_22

      Hi In my VC++ Socket programme I can connect to another system and transfer the data between them, the system are connected through LAN. I want to know how can communicate with another system through Internet by socket programme(with out LAN ,through Internet). (Like Server running in anywhere and client was Running anywhere they are connect through internet by Socket programme) Regards shakumar

      shakumar

      J Offline
      J Offline
      Jason Teagle
      wrote on last edited by
      #2

      It should work exactly the same - your connect() call can specify 'www.codeproject.com' just as easily as it can specify '192.168.0.5' - if this does not seem to work, perhaps a small code sample showing how you try to connect to the remote server would help us see where the problem lies?

      1 Reply Last reply
      0
      • S shakumar_22

        Hi In my VC++ Socket programme I can connect to another system and transfer the data between them, the system are connected through LAN. I want to know how can communicate with another system through Internet by socket programme(with out LAN ,through Internet). (Like Server running in anywhere and client was Running anywhere they are connect through internet by Socket programme) Regards shakumar

        shakumar

        G Offline
        G Offline
        GauranG Shah
        wrote on last edited by
        #3

        You shouldn't be facing any problem to connect to the Internet Server. But to Retrive or to send the Data on the Internet server you need to follow the Http protocol. that mean you first need to send the Http Header. That depends on the metod you are using. There are two Methods in Http, Http POST and Http GET. Try to find out the header for that and Send it Before you send the data. The Sample Header is as Follow. Try it if it works "POST / HTTP/1.0\n Accept: image/gif, image/x-xbitmap, */*\n Accept-Language: en-us\n Accept-Encoding: gzip, deflate\n User-Agent: Mozilla/4.0\n Host: WWW.CODEPROJECT.COM\n Content-Type: application/x-www-form-urlencoded"

        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