 |
|
|
 |
 | vb.net  srikanth goud | 21:40 27 Sep '07 |
|
|
 |
|
 |
Hi,
I've created a multithreaded app, and used part of your ping control, but Im having a problem with it. Essentially each thread is seeing a succsessfull repsonse from another threads IP address, even when its own ip address should not get a response.
i.e Thread 0 pings 10.0.0.1 (should get no response) Thread 1 pings 10.0.0.2 (should get a respone)
Both threads return a succsessfull ping. If i dont multithread (so one ping at a time) then it works ok.
Any ideas?
P.S. - What form of licencing is your code restricted to? or is completly open source?
Thanks
Jeff.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
 |
Hi
I never did find a solution as such, but I did write some code which (in my opinion anyway) worked better.
This is the code:
Public Function PingIPAddress(ByVal Destination As String) As Boolean Dim PingInfo As New System.Diagnostics.ProcessStartInfo("ping") PingInfo.WindowStyle = ProcessWindowStyle.Hidden PingInfo.Arguments = Destination & " -n 1" PingInfo.CreateNoWindow = True PingInfo.UseShellExecute = False PingInfo.RedirectStandardOutput = True Dim SystemProcess As New System.Diagnostics.Process SystemProcess.StartInfo = PingInfo SystemProcess.Start() SystemProcess.WaitForExit() Dim tmpResult As String tmpResult = SystemProcess.StandardOutput.ReadToEnd If InStr(tmpResult, "Reply from") > 0 Then Return True Else Return False End If End Function
Essentially it calls the DOS ping command and returns the results. It then simply checks for the "Reply from" text (or lack of). I'm sure it will give you the basis for retrieving more info if required.
Hope it helps 
Jeff.
|
| Sign In·View Thread·PermaLink | 1.00/5 |
|
|
|
 |
|
|
 |
|
 |
This is a problem that I have run into with a lot of code samples, they accept all pings without checking the ID. To fix this problem you need to set the identifier to some random number and then check to make sure that you recived the correct Identifier.
|
| Sign In·View Thread·PermaLink | 1.00/5 |
|
|
|
 |
|
 |
This is a nice sample, but I am having the same problem I have with all the "ping" samples I find on the web: the first ping comes back just fine, but subsequent pings return '0' as if they didn't work at all, until I restart the application. I have seen other people post this similar problem on another ping sample, but no one had answered them.
I am running winxp pro sp2 with .net framework 1.1 and vs.net 2003(winxp firewall turned OFF)
Thanks, Elijah
|
| Sign In·View Thread·PermaLink | 1.50/5 |
|
|
|
 |
|
 |
Hi Elijah,
I tested it here on my network and found that it workings fine.
The '0' that you are referring to, I think, is the response time in milliseconds. If you run the code in debug mode, you will see that 'Ping' function is executed every time.
I would really like to help you, but I need more information on your actual problem. Thank you for your interest Hendrik
|
| Sign In·View Thread·PermaLink | 2.00/5 |
|
|
|
 |
|
|
 |