[DUG] Indy Sockets - How to Receive Asynchronously

Kyley Harris kyleyharris at gmail.com
Thu Dec 4 09:21:03 NZDT 2008


Indy is blocking, so typically on the client side, you would create a
waiting thread that you sit the TCPClient inside and loop a readtimeout
until the resultbuffer has some data. At that point produce a local event so
that your main thread can grab the TCPClient and read the information.
without knowing your actual program design and how your TCP layer interacts
with your main application its hard to offer any detailed advise, sorry.

On Thu, Dec 4, 2008 at 9:14 AM, Paul <paul.blommaerts at telenet.be> wrote:

>  Indy works blocking only
> Use ICS instead, they work blocking or non blocking.
> check www.overbyte.be
>
> Paul
>
> ----- Original Message -----
> *From:* Eric A <eaa603 at hotmail.com>
> *To:* Delphi UsersGroup <delphi at delphi.org.nz>
> *Sent:* Wednesday, December 03, 2008 8:55 PM
> *Subject:* [DUG] Indy Sockets - How to Receive Asynchronously
>
> I have a situation where I need to communicate with a communications server
> using Indy TCP sockets.
>
> After sending the command the server returns an "OK" response with a second
> or two to acknowledge the acceptance of the command, however the reponse
> from the end device (returned via the server) may take several minutes to
> eventuate (or a else the sever returns a timeout message).  I need to be
> able to buffer the responses, be aware of when new strings arrinve, and
> carry on with other tasks.  This threading aspect shouldn't be an issue as I
> understand that Indy is naturally multitrheaded by design.
>
> I'm not familiar with using the Indy sockets and since there's no "received
> data event" (due to the nature of the design) I'm wondering how I capture
> the asynchronous responses sensibly?
>
> Does anyone have some code to show me how to use the Indy 10 TCPClient
> component in this way (for the receive part) ?  Its probably pretty simple
> but I need to get my head around it quickly.
>
> Thanks
>
> Eric
>
> ------------------------------
> Start searching now Rental properties galore.<http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fwww%2Eallrealestate%2Eco%2Enz%2Fcgi%2Dbin%2Frsearch%3Fa%3Dbhp%26t%3Dren%26cu%3Frsf%3Dmsnz%5Ftextlink&_t=26000&_r=REANZ_tagline&_m=EXT>
>
> ------------------------------
>
> _______________________________________________
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi at delphi.org.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to delphi-request at delphi.org.nz with Subject:
> unsubscribe
>
>
> _______________________________________________
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi at delphi.org.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to delphi-request at delphi.org.nz with Subject:
> unsubscribe
>



-- 
Kyley Harris
Harris Software
+64-21-671-821
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserver.123.net.nz/pipermail/delphi/attachments/20081204/ee36f8d6/attachment.html 


More information about the Delphi mailing list