troubleshooting Question

how to introduce timer in my code vb.net

Avatar of Zoldy2000
Zoldy2000Flag for Canada asked on
Visual Basic.NET
38 Comments2 Solutions495 ViewsLast Modified:
below is working code to listen for UDP message ..      what I need to do now is while it is listening introduce a timer that if it listens for 30 seconds and does not hear anything it executes some code then begins listening again resetting the timer.    Part of code below where I would like the timer.   Thanks in advance

While Not done
                    Console.WriteLine("Waiting for broadcast")
                    Dim bytes As Byte() = listener.Receive(groupEP)
                    Console.WriteLine("Received broadcast from {0} :", _
                        groupEP.ToString())
                    'Console.WriteLine( _
                    UDPMessage = Encoding.ASCII.GetString(bytes, 0, bytes.Length)
                    Console.WriteLine()
                    If UDPMessage.Contains(UDPMessagePart) Then
                        Proc = Process.GetProcessesByName("viewer")
                        If Proc.Count > 0 Then
                            GoTo SkipOpen
                        Else
                            Shell("c:\image.jpg")
                        End If
ASKER CERTIFIED SOLUTION
Mike Tomlinson
High School Computer Science, Computer Applications, Digital Design, and Mathematics Teacher
Join our community to see this answer!
Unlock 2 Answers and 38 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 38 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros