Solved

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

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

820 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