Results 1 to 3 of 3

Thread: DoEvents issue

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2006
    Posts
    4

    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.

  2. #2
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    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.

  3. #3

    Thread Starter
    New Member
    Join Date
    Apr 2006
    Posts
    4

    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
  •  



Click Here to Expand Forum to Full Width