Solved

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

Posted on 2009-04-02
3
743 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

757 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

18 Experts available now in Live!

Get 1:1 Help Now