Re: Error with TApdWinsockPort
> yes, i am using loops to process incoming data. Just like
> until Allreceived or timeout;
> What can I do then, to get it work correctly?
I would just like to make a few comments about using a loop in your
application. When I first started using AsyncPro I put a lot of similar
loops into my applications. It is the natural way to handle things but
it is not the Windows event-oriented way. I'd like to give you two
alternatives to consider.
If your program is simple then you could use a state variable inside of
the events where data is received (data packets or OnTriggerAvail) and
also timeout events. But in my experience if the protocol or sequence
of commands is complex then the code ends up being very hard to maintain
With most of the applications I've written, I want the application to be
unresponsive (at least in prevention of further device commands) while
I'm communicating with the external device. To me this is similar to an
email program where I do "Get Mail" and I either wait for that process
to complete or else I need to do "Stop".
The ExBlock and ExThread examples on this page demonstrate my basic
In my experience writing blocking function calls as those examples
demonstrate has several advantages:
1) In the main application you just have the blocking function calls in
sequence. It is very easy to see your control loops and error recovery
2) It is easy to isolate the communication engine in separate units so
it can be reused in other programs.
3) A single blocking function call can be extended to handle retries and
other error recovery in the engine itself, so the main application does
not need to be concerned.
When I need the application to be responsive while continuous
communication is occurring, I'll usually add another "script" thread,
and my blocking function calls will be made from that thread.
http://www.turbocontrol.com/TPSupport.htm - TurboPower support links