I am finding that the PING function that ships in VB.NET seems to not always work on corporate networks, so I want to know what I can do to improve the probability of finding a host at an address.
The program allows the user to enter a list of addresses, and then it pings each address within that range and returns a table of devices
What I'm finding on large corporate networks is
1. The ping doesnt always find a device at an address even when a device is there
2. If I run it multi threaded, the probability of finding a device seems to reduce further
3. I have set default timeout to 100, and TTL=255, but so far I am only pinging each box once, whereas DOS ping obviosuly pings 4 times
Even with timeout upped to 5000, the problem exists.
I dont get many shots are large networks, so really I want to get it right next time..
My questions are:
(a) Would increasing the number of attempts from 1 to 4 or even more help ?
(b) Does it matter what size of data you send. I don't actually tell ping what data to send, so I suppose there must be a default byte array that it sends
(c) What other parameters can I set to get the absolute maximum probability of a ping response
(d) Multi threaded is definitely needed due to the time for each ping on a slow network, so any discussion on parameters related to multithreading would be appreciated
Public Function Ping(ByRef sAddress As String, ByRef sDataToSend As String, _
ByVal lTimeOut As Integer, ByVal lTtl As Integer, _
ByRef lResult As System.Net.NetworkInformation.IPStatus) As Integer
Dim sn As New System.Net.NetworkInformation.Ping
Dim re As System.Net.NetworkInformation.PingReply
Dim op As New System.Net.NetworkInformation.PingOptions
If sAddress = "" Then
op.Ttl = lTtl
re = sn.Send(sAddress, lTimeOut)
Catch ex As System.Net.NetworkInformation.PingException
Catch ex As System.Exception
lResult = re.Status
If lResult = System.Net.NetworkInformation.IPStatus.Success Then