Solved

System.net.networkInformation.ping causes my application to hang...

Posted on 2009-04-02
3
747 Views
Last Modified: 2013-11-07
I created a class that will monitor if a certain device(with IP address) is connected to my network. But the method I am using causes my Application to hang...

Any ideas on how to achieve this?

Below is the code I am using... (Visual Basic 2005)



 Private Sub TimerTick(ByVal sender As System.Object, ByVal e As System.EventArgs)
        'Application.DoEvents()
        ''System.Threading.Thread.Sleep(20)
        'Dim pingDevice As New System.Net.NetworkInformation.Ping
        'If pingDevice.Send(_IPAddress).Status = Net.NetworkInformation.IPStatus.Success Then
        '    AddHandler FingerPrintDevice.OnAttTransaction, AddressOf FingerScanningTransaction
        '    _isDeviceConnected = True
        'Else
        '    RemoveHandler FingerPrintDevice.OnAttTransaction, AddressOf FingerScanningTransaction
        '    _isDeviceConnected = False
        'End If

        'RaiseEvent DeviceStatus(_DeviceID, _DeviceName, _IPAddress, _isDeviceConnected)

    End Sub
0
Comment
Question by:JackOfPH
  • 2
3 Comments
 
LVL 9

Accepted Solution

by:
VikramMullick earned 500 total points
ID: 24056755
You can use Ping from System.Net.NetworkInformation, but if you want your application to not hang you must use System.Threading
try this link
http://social.microsoft.com/Forums/en-US/netfxnetcom/thread/b7521e65-093f-4b87-8114-d1f6e311d86a/
0
 
LVL 15

Author Comment

by:JackOfPH
ID: 24057245
Thanks for the help...

:)
0
 
LVL 15

Author Closing Comment

by:JackOfPH
ID: 31566113
Thanks for the tipo...
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now