|
-
Dec 21st, 2005, 06:15 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Problem with My.Computer.Network.Ping
I'm trying do do something that on the face of it should be pretty easy,basically I'm trying to ping a range of IP addresses and list the ones that respond in a listbox.
The code below actually does ping the ip addresses and lists the ones that respond in the listbox but there are a few problems.
1. the IP addresses that respond are only listed when the whole process is complete, what I want it to do is add the address as it responds so a list is 'seen' to be created.
2.The label that should show the current address being pinged doesn't, it just shows the final address, again this happens when the whole process is complete.
3. Finally and most seriously the process takes and absolute age to complete, even if i set the time out in My.Computer.Network.Ping to 10ms, I've really no idea why its taking so long, according to the info in VS2005 express help it seems that only one atempt is made to contact the address so the whole process should complete in around 3 seconds but it's more like 2 mins 
VB Code:
Private Sub btnGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGo.Click
Dim i As Integer
Dim strIP As String
For i = 1 To 254
strIP = txtSubNet.Text & "." & i
'display the current IP address being pinged
lblCurrentPing.Text = strIP
If My.Computer.Network.Ping(strIP) Then
'if the IP address responded add to the listbox
lstIPaddress.Items.Add(strIP)
End If
Next
End Sub
any help greatly appreciated
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|