Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 610
  • Last Modified:

How vb6 Handles Multiple Events ?

Hi,

I would like to have multiple(about 6-10)MSCOMM controls
created at design time as a control array.

so we have only one event handler.

The events are generated asynchronously according to the
data on the ports(not very often probably every 1-2
seconds ).

My question is how does vb handle multiple events that are
generated. Are some events lost if not handled very soon.
How many events can the windows OS & VB hold so that some
events are not lost?

Thanks
kodela

0
prakrithk
Asked:
prakrithk
2 Solutions
 
RanaHossainCommented:
Hi Kodela,

I am writing a POP3 checker for my IIS server, which now uses upto 10 threads to check E-mail. Now with no e-mails, it takes about 1.3 seconds to check 8 e-mails..

So I guess what I am trying to say is, each thread has about 3 external events, which raises some more.. so if you are thinking one event every 1-2 seconds .. should be fine.
0
 
marconovaroCommented:

Hi Kodela,

the events are managed in a synchronous way. That is, the full event code is executed, before "listening to" a new event. This means that you should not have problems. Furthermore, 1-2 seconds is not so much (you should execute the full code in some microseconds).

UNLESS you are going to use DoEvents in the MSComm_OnComm event: do not do this! This is because if you use DoEvents, you could receive again the same event, and enter a recursive loop, that could cause you bad errors (out of stack space).

If you fear not to cope with the speed of the upcoming events, do something like this:

- in the OnComm event, read the buffer and put it into a FIFO
- set a timer, and parse the FIFO buffer there.

This will "separate" the incoming events from the time you need to parse them


Hope this helps.
M
0
 
CleanupPingCommented:
prakrithk:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Experts: Post your closing recommendations!  Who deserves points here?
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now