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