How to ping

BlackOne

New member
Joined
Jun 27, 2009
Messages
1
Programming Experience
1-3
Hi all!

I'm making a program for my wireless network witch is connected on mysql db and read from table "spot" data "name, ip , up, down, status, last_up" then i wonna ping ip every 5 min then insert new data in DB is spot online ofline ,...

name - name of spot
ip - ip adress of spot
up - How long is spot up
down - how long is spot down
status - is spot up or down
last up - whan is spot was last online

I connected with db with this code and show data in datagridview

VB.NET:
    Private Sub refreshStatus(ByRef statusView As DataGridView)
        Dim conn As New MySqlConnection
        Dim myCommand As New MySqlCommand
        Dim myAdapter As New MySqlDataAdapter
        Dim myData As New DataTable
        Dim SQL As String

        SQL = "SELECT naziv, ip, status, up, down, last_up FROM tocke "

        conn.ConnectionString = myConnString

        Try
            conn.Open()
            Try
                myCommand.Connection = conn
                myCommand.CommandText = SQL

                myAdapter.SelectCommand = myCommand
                myAdapter.Fill(myData)


                statusView.DataSource = myData
                dgvStatus.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells
            Catch myerror As MySqlException
                MsgBox("There was an error reading from the database: " & myerror.Message)
            End Try
        Catch myerror As MySqlException
            MessageBox.Show("Error connecting to the database: " & myerror.Message)
        Finally
            If conn.State <> ConnectionState.Closed Then conn.Close()
        End Try


    End Sub

now how to make to ping ip of spot i wonna ping with whis code and how to enter new data in table please help!

VB.NET:
If My.Computer.Network.Ping("www.google.com", 1000) Then
  		MsgBox("Server pinged successfully.")
	Else
  		MsgBox("Ping request timed out.")
	End If

when i make this i will easy make in php statistic is hotspot online or ofline how long is online or offline...
 
Back
Top