Also, I have not looked at indy for a long time, but I think they have new objects at a higher level called TCPCommand, which supports CRLF message management with events.
On Thu, Dec 4, 2008 at 10:06 AM, Kyley Harris <[EMAIL PROTECTED]> wrote: > in that case, your TCP thread should just loop read everything into your > own buffer and everytime you find CRLF you can grab the complete message > from the buffer and trigger an event. to stop yourself getting lock timeouts > on reads use the checkfordataonsource and then read whatever is in the input > buffer, that way you wont ever get a long timeout waiting for data that > might not come. > > > On Thu, Dec 4, 2008 at 10:01 AM, Eric A <[EMAIL PROTECTED]> wrote: > >> Known factors: >> >> 1. I don't know what size message will be returned. >> >> 2. The message always ends in CR LF >> >> 3. The message is always printable ASCII (not Unicode). >> >> >> >> >> ------------------------------ >> >> Date: Thu, 4 Dec 2008 09:48:52 +1300 >> >> From: [EMAIL PROTECTED] >> To: [email protected] >> Subject: Re: [DUG] Indy Sockets - How to Receive Asynchronously >> >> Also, I guess the type of data and your message layer has a big impact on >> how you design your data receiver. >> >> in my own client/servers where I control the protocol, all my messages >> first send an 8byte size packet.. So my read queue is constantly just doing >> ASize := StrToInt( '$'+ReadString(8) ) { 8 byte hex } and this is looping.. >> as soon as I get a successful size I can then read the specific size of data >> into a message object and continue polling. If I need to send very large >> data like binary files,, I break it down into smaller packets encapsulated >> in messages using the above method. >> >> On Thu, Dec 4, 2008 at 9:31 AM, Eric A <[EMAIL PROTECTED]> wrote: >> >> Kyley, >> >> No program design yet. Questions: >> >> 1) Inside the thread - do I have to implement a timer event to >> periodically check the buffer (since there's no "data received" event)? >> >> 2) What properties do I read to determine if there's received data >> available? >> >> 3) Do I need to use another Indy component in conjunction with the >> TCPClient for the buffering etc? >> >> >> Paul, >> >> I'll take a look at that site. Are you using ICS extensively? >> >> >> Thanks, >> Eric >> >> >> >> >> >> >> ------------------------------ >> >> Date: Thu, 4 Dec 2008 09:21:03 +1300 >> From: [EMAIL PROTECTED] >> To: [email protected] >> Subject: Re: [DUG] Indy Sockets - How to Receive Asynchronously >> >> >> 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 <[EMAIL PROTECTED]> wrote: >> >> Indy works blocking only >> Use ICS instead, they work blocking or non blocking. >> check www.overbyte.be >> >> Paul >> >> ----- Original Message ----- >> *From:* Eric A <[EMAIL PROTECTED]> >> *To:* Delphi UsersGroup <[email protected]> >> *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://www.allrealestate.co.nz/cgi-bin/rsearch?a%3Dbhp%26t%3Dren%26cu?rsf%3Dmsnz_textlink&_t=26000&_r=REANZ_tagline&_m=EXT> >> >> ------------------------------ >> >> _______________________________________________ >> NZ Borland Developers Group - Delphi mailing list >> Post: [email protected] >> Admin: http://delphi.org.nz/mailman/listinfo/delphi >> Unsubscribe: send an email to [EMAIL PROTECTED] with Subject: >> unsubscribe >> >> >> _______________________________________________ >> NZ Borland Developers Group - Delphi mailing list >> Post: [email protected] >> Admin: http://delphi.org.nz/mailman/listinfo/delphi >> Unsubscribe: send an email to [EMAIL PROTECTED] with Subject: >> unsubscribe >> >> >> >> >> -- >> Kyley Harris >> Harris Software >> +64-21-671-821 >> >> ------------------------------ >> MSN NZ Travel Get inspired - dream, research, plan and book your next >> holiday online with >> <http://a.ninemsn.com.au/b.aspx?URL=http://travel.msn.co.nz&_t=771497011&_r=MSN_NZ_travel_hmtagline&_m=EXT> >> >> _______________________________________________ >> NZ Borland Developers Group - Delphi mailing list >> Post: [email protected] >> Admin: http://delphi.org.nz/mailman/listinfo/delphi >> Unsubscribe: send an email to [EMAIL PROTECTED] with Subject: >> unsubscribe >> >> >> >> >> -- >> Kyley Harris >> Harris Software >> +64-21-671-821 >> >> ------------------------------ >> MSN NZ Travel Get inspired - dream, research, plan and book your next >> holiday online with >> <http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Ftravel%2Emsn%2Eco%2Enz&_t=771497011&_r=MSN_NZ_travel_hmtagline&_m=EXT> >> >> _______________________________________________ >> NZ Borland Developers Group - Delphi mailing list >> Post: [email protected] >> Admin: http://delphi.org.nz/mailman/listinfo/delphi >> Unsubscribe: send an email to [EMAIL PROTECTED] with Subject: >> unsubscribe >> > > > > -- > Kyley Harris > Harris Software > +64-21-671-821 > -- Kyley Harris Harris Software +64-21-671-821
_______________________________________________ NZ Borland Developers Group - Delphi mailing list Post: [email protected] Admin: http://delphi.org.nz/mailman/listinfo/delphi Unsubscribe: send an email to [EMAIL PROTECTED] with Subject: unsubscribe
