G
Guest
Hi
Ive been advised to use events in my app. I have a worker thread that listens for UDP packets. It converts the incoming UDP Byte array into a Packet object. This then gets placed onto a ReceivedPackets Queue. Im not too familiar with Events but need to know how to get my thread to fire the event and my form, could 1 of 9 forms, to detect that event has been fired and handle it
I know that I should use "RaiseEvent" in the Thread. The thread has been declared in a Module. How do I put it all together? I guess the forms need something like "AddHandler EventName, New EventHandler Addressof procedureToRun" but donr know how to put it all together. I tried but the Thread was complaining of an "End of statement expected" compilor error
Also, If Ive received 2 packets with a 200ms interval between them and hence the event gets fired twice, what happens? does the app wait for the first procedure to finish executing and then call the method again in response to the second event firing? Can this cause potential delay/problems in my app
Im using VB.NET but C# will suffice
Thanks.
Ive been advised to use events in my app. I have a worker thread that listens for UDP packets. It converts the incoming UDP Byte array into a Packet object. This then gets placed onto a ReceivedPackets Queue. Im not too familiar with Events but need to know how to get my thread to fire the event and my form, could 1 of 9 forms, to detect that event has been fired and handle it
I know that I should use "RaiseEvent" in the Thread. The thread has been declared in a Module. How do I put it all together? I guess the forms need something like "AddHandler EventName, New EventHandler Addressof procedureToRun" but donr know how to put it all together. I tried but the Thread was complaining of an "End of statement expected" compilor error
Also, If Ive received 2 packets with a 200ms interval between them and hence the event gets fired twice, what happens? does the app wait for the first procedure to finish executing and then call the method again in response to the second event firing? Can this cause potential delay/problems in my app
Im using VB.NET but C# will suffice
Thanks.