Linux / C++: Get Internet IP Address (not local computer's IP) -


How do I get an Internet IP address from the program?

1) If the computer is connected directly to the Internet using a USB modem.

2) If the computer is connected to the Internet through another computer or modem / router.

Do I have a way of doing both?

The PS actually gives the Internet IP, but how can I use it in my program?

  1. You can write socket code to send an HTTP request for that link

  2. You can use the system under Unix / Linux / Signin ("wget"); Then open the file "n09230945.asp" and read its contents.

Here is an example of how to request to use sockets (I aim to modify online examples for this specific purpose). Note: This is an example and an actual implementation will have to handle better errors:

  #include  

Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -