Results 1 to 2 of 2

Thread: How to ping...

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2007
    Location
    Croatia/Čepin
    Posts
    13

    How to ping...

    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

    Code:
    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!

    Code:
    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...

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: How to ping...

    Look in the System.Net namespace... I think there's a class in there that will allow you to ping....

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width