0

I'm modifying some C# code that queries http://checkip.dyndns.com/ and derives the external IP from the sites HTML response. However, this specific site has a tendency to timeout and at times accessing it in Chrome or any browser may generate a connection reset error. This causes the program I'm modifying to fail intermittently when performing one of its primary network configuration tasks.

Falling back on my high school CCNA training though, I have considered two possible solutions.

  1. Extending the timeout period when querying the site for the local machines external IP.

This solution seems ideal, because I am not aware of a better site to use in terms of simplicity of response and I'd rather not deal with the extra work of modifying the code that interprets the http response and scrapes the IP. It does however present the issue that I'm not exactly sure how I might go about doing this or what keywords to look for in the source. As it is not my project, I am not entirely familiar with the program architecture. If anyone has any suggestions the source can be found here: http://littlegreatideas.com/procrastineering/files/videochatrobot/VideoChatRobot_v02.zip

Opening the project file and simply Ctrl-F'ing for the URL: http://checkip.dyndns.com/ will yield some of the relevant code.

  1. Changing sites to query a different, more responsive site. Thus, also changing the scraping code, which is not ideal in my mind, but would not be bad experience either.

Thanks beautiful people, the help is much appreciated!

Theo
  • 1,821
  • 2
  • 17
  • 11
  • possible duplicate of [Get public/external IP address?](http://stackoverflow.com/questions/3253701/get-public-external-ip-address) – Robert McKee May 05 '15 at 15:44

2 Answers2

1

You could try this site instead: http://ip.telize.com/

Robert McKee
  • 21,305
  • 1
  • 43
  • 57
1

You could query multiple sites and use whichever responds first. This requires writing quite a bit of code for scraping.
An alternative would be to use the STUN protocol and use Google's STUN servers. The STUN protocol was designed for this exact usage (among other things).

Jonas
  • 491
  • 6
  • 22
  • Thank you Jonas, I wasn't familiar with STUN. I'm not sure if I'll have the time to implement it in this configuration, because of time constraints, but I'll definitely keep it in mind for the future. As for scraping multiple sites I do like that idea, but I'm not sure if I'll have the time to write the scrape code. Will see how much work will be necessary and then decide on that. – Theo May 05 '15 at 16:01