> Hmmm, you know that a very important thing about
> Unicode-compatilbility (in
> addtion to _T() and _txxx()) is not expecting a particular size of a
> character, and instead using sizeof(TCHAR), I'm certain.
>
> So, by all means try it.
Very true, I am aware of this. The messages being sent are Modbus, and thus
are bytes (always one byte per 'character') rather than text characters.
> I don't get something. What makes you poll? Can't you just issue an
> overlapped I/O, and wait for its results, and return to the VB app only
> after that?
Well, for one thing the response to the message sent out may not all be seen
in one packet (it should, but life isn't that perfect) - particularly as
this device works at 9600 Baud. That means the VB code will most likely need
to make several calls into the control to get the complete response it
expects.
I /do/ believe, based on your responses, that I could change the code to
wait until it receives something or times out (it would be quite OK to tell
the comms control how long to wait for a response before timing out) - this
would certainly reduce the polling dramatically - but I'm afraid can't be
done for now, that will have to be later.
But bear in mind that the VB code is polling the /control/ to see what it
has in its RX buffer - it is not directly polling the comms system. That. of
course, is handled by the receive thread waiting for an event. So the
polling is not exactly what I suspect you are thinking. It is, however,
probably still wasting some processor time.
>
> But if you *have* to poll for the data anyway, then I'm afraid IOCP's will
> not be much better than overlapped I/O, since it's the polling
> which should
> be the biggest performance killer in this situation.
But the problem I have to ask is, why is that exact same polling method
slower on XP than on 98 (if that is where the bottleneck occurs)? This is
what I'm trying to find out, most importantly. Although I do want to know if
there's a more efficient way on NT systems, I mean a way that is unique to
NT architecture that has been specifically designed as an improvement over
non-NT systems, rather than just using an inefficient method in my code {:v)
Most of all, I want to know what causes XP to be slower for the same code.
> You need a little reading on IOCP's (I/O Completion Ports).
>
> For a very good introduction to IOCP's, check the "Writing Scalable
> Applications for Windows NT" article by John Vert in the MSDN.
> Also, check
> out the "Writing Windows NT Server Applications in MFC Using I/O
> Completion
> Ports" (Ruediger Asche) and "Win32 Multithreading Performance" (Ruediger
> Asche) articles for more in-depth information.
Are you saying that IOCP can't be used on non-NT versions of Windows?
--
Jason Teagle
[EMAIL PROTECTED]