Also, I guess the type of data and your message layer has a big impact on how you design your data receiver.<div><br></div><div>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 &nbsp;ASize := StrToInt( &#39;$&#39;+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.<br>
<br><div class="gmail_quote">On Thu, Dec 4, 2008 at 9:31 AM, Eric A <span dir="ltr">&lt;<a href="mailto:eaa603@hotmail.com">eaa603@hotmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">




<div>
Kyley,<br>
&nbsp;<br>
No program design yet.&nbsp; Questions:<br>
&nbsp;<br>
1) Inside the thread - do I have to implement a timer event to periodically check the buffer (since there&#39;s no &quot;data received&quot; event)?&nbsp; <br>
&nbsp;<br>
2) What properties do I read to determine if there&#39;s received data available?&nbsp; <br>
&nbsp;<br>
3) Do I need to use another Indy component in conjunction with the TCPClient for the buffering etc?<br>
&nbsp;<br>
&nbsp;<br>
Paul,<br>
&nbsp;<br>
I&#39;ll take a look at that site.&nbsp; Are you using ICS extensively?<br>
&nbsp;<br>
&nbsp;<br>
Thanks,<br>
Eric<br>
&nbsp;<br>
&nbsp;<br>
&nbsp;<br>
<br><br>&nbsp;<br>

<hr>
<br>
Date: Thu, 4 Dec 2008 09:21:03 +1300<br>From: <a href="mailto:kyleyharris@gmail.com" target="_blank">kyleyharris@gmail.com</a><br>To: <a href="mailto:delphi@delphi.org.nz" target="_blank">delphi@delphi.org.nz</a><br>Subject: Re: [DUG] Indy Sockets - How to Receive Asynchronously<div>
<div></div><div class="Wj3C7c"><br><br>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.<br>

<div><br></div>
<div>without knowing your actual program design and how your TCP layer interacts with your main application its hard to offer any detailed advise, sorry.&nbsp;<br><br>
<div>On Thu, Dec 4, 2008 at 9:14 AM, Paul <span dir="ltr">&lt;<a href="mailto:paul.blommaerts@telenet.be" target="_blank">paul.blommaerts@telenet.be</a>&gt;</span> wrote:<br>
<blockquote style="padding-left:1ex;border-left:#ccc 1px solid">
<div>
<div><font face="Arial">Indy works blocking only</font></div>
<div><font face="Arial">Use ICS instead, they work blocking or non blocking.</font></div>
<div><font face="Arial">check <a href="http://www.overbyte.be/" target="_blank">www.overbyte.be</a></font></div>
<div><font face="Arial"></font>&nbsp;</div>
<div><font face="Arial">Paul</font></div>
<blockquote style="padding-right:0px;padding-left:5px;margin-left:5px;border-left:#000000 2px solid;margin-right:0px">
<div>
<div></div>
<div>
<div style="font:10pt arial">----- Original Message ----- </div>
<div style="background:#e4e4e4;font:10pt arial"><b>From:</b> <a title="eaa603@hotmail.com" href="mailto:eaa603@hotmail.com" target="_blank">Eric A</a> </div>
<div style="font:10pt arial"><b>To:</b> <a title="delphi@delphi.org.nz" href="mailto:delphi@delphi.org.nz" target="_blank">Delphi UsersGroup</a> </div>
<div style="font:10pt arial"><b>Sent:</b> Wednesday, December 03, 2008 8:55 PM</div>
<div style="font:10pt arial"><b>Subject:</b> [DUG] Indy Sockets - How to Receive Asynchronously</div>
<div><br></div>I have a situation where I need to communicate with a communications server using Indy TCP sockets.&nbsp; <br>&nbsp;<br>After sending the command the server returns an &quot;OK&quot; 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).&nbsp; I need to be able to buffer the responses, be aware of when new strings arrinve, and carry on with other tasks.&nbsp; This&nbsp;threading aspect shouldn&#39;t be an issue as I understand that Indy is naturally multitrheaded by design.<br>
&nbsp;<br>I&#39;m not familiar with using the Indy sockets and since there&#39;s no &quot;received data event&quot; (due to the nature of the design) I&#39;m wondering how I capture the asynchronous responses sensibly?<br>&nbsp;<br>
Does anyone have some code to show me how to use the Indy 10&nbsp;TCPClient component in this way (for the receive part) ?&nbsp; Its probably pretty simple but I need to get my head around it quickly.<br>&nbsp;<br>Thanks<br>&nbsp;<br>Eric<br>
<br>
<hr>
Start searching now <a href="http://a.ninemsn.com.au/b.aspx?URL=http://www.allrealestate.co.nz/cgi-bin/rsearch?a%3Dbhp%26t%3Dren%26cu?rsf%3Dmsnz_textlink&amp;_t=26000&amp;_r=REANZ_tagline&amp;_m=EXT" target="_blank">Rental properties galore.</a> </div>
</div>
<br>
<hr>

<br>_______________________________________________<br>NZ Borland Developers Group - Delphi mailing list<br>Post: <a href="mailto:delphi@delphi.org.nz" target="_blank">delphi@delphi.org.nz</a><br>Admin: <a href="http://delphi.org.nz/mailman/listinfo/delphi" target="_blank">http://delphi.org.nz/mailman/listinfo/delphi</a><br>
Unsubscribe: send an email to <a href="mailto:delphi-request@delphi.org.nz" target="_blank">delphi-request@delphi.org.nz</a> with Subject: unsubscribe
<br></blockquote></div><br>_______________________________________________<br>NZ Borland Developers Group - Delphi mailing list<br>Post: <a href="mailto:delphi@delphi.org.nz" target="_blank">delphi@delphi.org.nz</a><br>Admin: <a href="http://delphi.org.nz/mailman/listinfo/delphi" target="_blank">http://delphi.org.nz/mailman/listinfo/delphi</a><br>
Unsubscribe: send an email to <a href="mailto:delphi-request@delphi.org.nz" target="_blank">delphi-request@delphi.org.nz</a> with Subject: unsubscribe<br></blockquote></div><br><br clear="all"><br>-- <br>Kyley Harris<br>Harris Software<br>
+64-21-671-821<br></div><br></div></div><div class="WgoR0d"><hr>MSN NZ Travel  <a href="http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Ftravel%2Emsn%2Eco%2Enz&amp;_t=771497011&amp;_r=MSN_NZ_travel_hmtagline&amp;_m=EXT" target="_blank">Get inspired - dream, research, plan and book your next holiday online with </a></div>
</div>
<br>_______________________________________________<br>
NZ Borland Developers Group - Delphi mailing list<br>
Post: <a href="mailto:delphi@delphi.org.nz">delphi@delphi.org.nz</a><br>
Admin: <a href="http://delphi.org.nz/mailman/listinfo/delphi" target="_blank">http://delphi.org.nz/mailman/listinfo/delphi</a><br>
Unsubscribe: send an email to <a href="mailto:delphi-request@delphi.org.nz">delphi-request@delphi.org.nz</a> with Subject: unsubscribe<br></blockquote></div><br><br clear="all"><br>-- <br>Kyley Harris<br>Harris Software<br>
+64-21-671-821<br>
</div>