|
-
Apr 17th, 2006, 09:45 AM
#1
Thread Starter
New Member
DoEvents issue
Hi,
I have a program that gets lots of packets constantly(winsock).
The problem seems to be:
if I don't use DoEvents in my data_arrival code the events queue grows(?) and the program might crash.
if I use DoEvents some of the events are cut in the middle (becuase an event arrives) and lost.
Is there a way to avoid these problems (assuming working in a single threaded VB application).
Thanks,
Gill.
-
Apr 17th, 2006, 02:18 PM
#2
Re: DoEvents issue
Don't use DoEvent in DataArrival because it will mess up your data.
The only option is not to use it.
You have to make your program process the data faster than you receive the data.
For example if you get 10 packets per second, that means 100 ms per packet, then you have to make your program fast enough to process under 100 ms for each packet.
If you do that the queue don't grow, and your safe...
If you can't make your program that fast consider writing some of the code in C++ and call the functions from VB through API...
Or you can simply just save the data, and process it later. But that depends on the program you are making.
-
Apr 19th, 2006, 03:30 AM
#3
Thread Starter
New Member
Re: DoEvents issue
OK.
Thanks a lot for your reply.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|