NetTalk Central

Author Topic: How to test for an internet connection?  (Read 3670 times)

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
How to test for an internet connection?
« on: May 28, 2014, 07:27:35 AM »
Hi,
I need to test if the server has internet connection.
How can I do it?
Thanks
-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: How to test for an internet connection?
« Reply #1 on: May 28, 2014, 10:51:01 PM »
lots of ways - depending on how you define "the internet".
One option is just to ping www.google.com.

Personally I prefer to just "do what you need to do". If you get an error then deal with the error.

cheers
Bruce

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: How to test for an internet connection?
« Reply #2 on: May 29, 2014, 01:59:44 AM »
It is a complex problem.
My client has a non stable internet connection with a telephonic ISP
They need to know when the server lost this connection because theyre own clients complains about it
They has an internal smtp and my idea is to check for the internet conn and send them an internal mail.
How would you do this?
Thanks
-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: How to test for an internet connection?
« Reply #3 on: May 29, 2014, 05:18:24 AM »
I'd just ping google.
NetDemo has an example of doing a ping - it's in one of the menu items as I recall.

cheers
Bruce

Djordje Radovanovic

  • Full Member
  • ***
  • Posts: 237
    • View Profile
Re: How to test for an internet connection?
« Reply #4 on: June 02, 2014, 12:36:40 PM »
Hi Michelis,

I found this by accident and if you have File Explorer than it will work for you

fe_OnlineStatus
fe_OnlineStatus ( byte pOption=0 ) ,byte

Description

    This function's purpose is to establish whether you are currently connected to the internet. The behaviour / result of the function is determined by the parameter pOption.
    If pOption is omitted (or passed as zero), this function will simply return true (1) or false (0), indicating whether you are connected or not.
    if fe_OnlineStatus() = 1
    message ('I am connected!')
    end
    If pOption is passed as 1, 2, 3 or 4, this function returns the following:
        pOption=1; returns true / false indicating whether the local system is in offline mode
        pOption=2; returns true / false indicating whether the local system uses a modem to connect to the internet
        pOption=3; returns true / false indicating whether the local system uses a local network area to connect to the internet
        pOption=4; returns true / false indicating whether the local system uses a proxy server to connect to the internet
    if fe_OnlineStatus(4) = true
    message('You are connected through a Proxy Server')
    end
    If the function returns a negative number it indicates that an error occurred.

Best regards,

Djordje Radovanovic

JohanR

  • Sr. Member
  • ****
  • Posts: 375
    • View Profile
    • Email
Re: How to test for an internet connection?
« Reply #5 on: June 04, 2014, 01:29:00 AM »


Hi,

Another way would be to do it from outside in.

Check uptimerobot.com,
it will monitor your server and keep a log, and notify you if the server is down.


Johan