Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2009-04-02
3
Medium Priority
?
793 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 2000 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

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

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…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses

963 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