Hello everyone
Anybody to help me with this please
How can make an app that will check the server/URL if it's Online/offline using visual basic 2010
I know that i can just ping it using the CMD but i want something that will be in the app i'm aiming to create
I'm happy with the basic codes, But i will be pleased if you could give me something that it works very well
Thank you so much for your helps as always i get them from this site
Thanks again

Doogledude123
Thanks for your reply, But i found it a bit diffecult to understand it, Because it doesn't say where you should put the code, or if you will need a textbox or a button or .. ? any idea ?

Here's an easier one, Try it, if it doesnt work, come back and ill try another.

Dim output As System.Net.NetworkInformation.PingReply
Dim pinger As New System.Net.NetworkInformation.Ping
output = pinger.send(address)
msgbox(output.RoundtripTime.ToString)

That will tell you whether the machine is on the network but does not tell you if the server is up. Of course, "up" is open to interpretation. If you are running multiple services (FTP, WEB, etc) what can be non-responsive before it is considered not to be up?

Hello Doogledude123, Thanks for your time
Could you please do me one like you can type/paste the URL/Server IP Address in a textbox and then check it by clicking on a button
Thank you so much again for your help :)

Create a Button, Change (Name) property to Ping, and a TextBox, Change (Name) property to AddressText, only 1 form is needed.

Paste this code over top of ALL code.

Public Class Pinger

    Private Sub Ping_Click(sender As Object, e As EventArgs) Handles Ping.Click
        Call PingNow()
    End Sub

    Sub PingNow()
        Dim output As System.Net.NetworkInformation.PingReply
        Dim pinger As New System.Net.NetworkInformation.Ping
        output = pinger.Send(AddressText.Text)
        MsgBox(output.RoundtripTime.ToString)
    End Sub
End Class

This works fine, But each time i ping the server, I get some numbers
When i ping the servers that i know is up, I get (0) message, That will make sense if the 0 means it's UP
But when i ping a server that i know is down, Each time i ping it i get different numbers, So these numbers could be means please ?
Thanks for your help :)

Pinging a server by name may not always get you the same IP address. Daniweb is hosted on more than one server and you can't determine which server will respond at any given time. Also, not all servers are set up to respond to a ping. Sometimes this is disabled to prevent malicious code from pinging address ranges to look for active ones.

What ping does, is essentially sends the URL or IP a byte requesting one back, the numbers are telling you how fast you got it back.

If you want to know if a website or IP is online or active, then ping it. If the number is >= 0 then its active, else, it will give you an error. You can use this to determine if the thing you are pinging is online.

Ill give you an example in Sudo Code, if you cant figure it out, come back and ill give you the actual code.

If the response is greater than or equal to 0 then
    tell the user the host is online
if the computer didnt send back a number then
    tell the user the host is offline.

I got it now, Thank you so much for taking time to explain it, Because i just couldn't understand each time i used to ping a server it used to give me different numbers
thanks again :)

A ping will not tell you if a website is active. It will only tell you if the server is on the network and responding. A server can run many services such as web, FTP, database, telnet, etc. Any or all of these can be non-functional and still have the server respond to a ping. And as I said before, some servers are set up to not respond to a ping for security reasons. The ping can be negative and still have the services available.

How about these website that you can check the status on the web server such as Host-tracker.com / checksite.us or downforeveryoneorjustme.com, How do they manager to get that information from the web server? Because i'm really interested in learning about it
I have seen some tools that been developed by some people which i heard that they have used the C and C++ / GUI to get it done, But how, I have got no idea.
I know that this is a bit strange, But is it possible for example to use one of the above links in your application and get just the result only without having to check web server on a browser?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.