Ping functionality

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

We do have a Ping class that follows the model from the desktop.

Something like this:

Private MyPinger As New OpenNETCF.Net.NetworkInformation.Ping
Private MyPingerReply As OpenNETCF.Net.NetworkInformation.PingReply

Try
Me.ListBox1.Items.Clear()
Me.Refresh()
Cursor.Current = Cursors.WaitCursor
MyPingerReply = MyPinger.Send("www.opennetcf.com")
Cursor.Current = Cursors.Default

Me.ListBox1.Items.Add("Status:" & MyPingerReply.Status.ToString)
Me.ListBox1.Items.Add("RoundTripTime:" &
MyPingerReply.RoundTripTime.ToString)
Me.ListBox1.Items.Add("Address:" &
MyPingerReply.Address.ToString)
Me.ListBox1.Items.Add("Options.DontFragment:" &
MyPingerReply.Options.DontFragment.TrueString)
Me.ListBox1.Items.Add("Options.Ttl:" &
MyPingerReply.Options.Ttl.ToString)


Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "App Exeption")
Cursor.Current = Cursors.Default
End Try
 
I have a VB.NET 2003 application for a handheld device that has a WiFi
connection. At any time the device can be connected to a Windows LAN, a
printer in adhoc mode, or neither. I would like to find a way of checking
that the printer is available before printing to it, and would like to be
able to implement something like a ping utility from VB code. Both the
handheld and the printer have static IP addresses, so I would like just to
be able to ping the printer from the handheld, and if I get a response, I
know it is safe to try and print. I thought that the functionality was
available using OpenNetCF, but have been unable to find out how to do it.
Any help would be appreciated.

Andy Baker
 
Back
Top