<div dir="ltr"><div>I can´t fill the buffer, SendMessage never returns 0. Why?</div>
<p>My code:</p>
<p>procedure TForm1.Button1Click(Sender: TObject);<br>var<br>  Buffer: string;<br>  Sent: integer;<br>begin<br>  Buffer := 'START—…—END'; // –> 1198469 characters<br>  Sent := LTCPComponent1.SendMessage(Buffer,LTCPComponent1.Iterator);<br>
  if Sent = 0 then<br>    ShowMessage('Buffer full')<br>  else<br>    ShowMessage(IntToStr(Sent)); // –> Show 1198469<br>end;</p>
<p>Best regards!</p><br><br>
<div class="gmail_quote">2008/9/29 Aleš Katona <span dir="ltr"><<a href="mailto:almindor@gmail.com">almindor@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Dňa Ne, 2008-09-28 o 20:14 +0200, Usuario Anónimo napísal:<br>
<div>
<div></div>
<div class="Wj3C7c">> I get an asyncronous socket error.<br>><br>> This is my code.<br>><br>> procedure TForm1.Button1Click(Sender: TObject);<br>> var<br>>   Item: string;<br>> begin<br>>   System.Assign(DataModule1.ItemFile,'items.txt');<br>
>   System.Reset(DataModule1.ItemFile);<br>>   repeat<br>>     System.Read(DataModule1.ItemFile,Item);<br>><br>> DataModule1.LTCPComponent1.SendMessage(Item,DataModule1.LTCPComponent1.Iterator);<br>>   until EOF(DataModule1.ItemFile);<br>
>   System.Close(DataModule1.ItemFile);<br>> end;<br>><br>> Why?<br><br></div></div>You need to check if .Send or .SendMessage in your case don't return 0.<br>If so either an error on the network occurred (reported by OnError<br>
event), or the OS send buffer is full and you need to use the OnCanSend<br>event. For more info on sending big data see:<br><a href="http://lnet.wordpress.com/usage/sockets-protocols-and-sending/" target="_blank">http://lnet.wordpress.com/usage/sockets-protocols-and-sending/</a><br>
<br>Btw. is DataModule now working properly in Lazarus? Last I tried it's<br>things weren't visible in the OI on other units of the project.<br><br>Ales<br>
<div>
<div></div>
<div class="Wj3C7c">> _______________________________________________<br>> Lazarus mailing list<br>> <a href="mailto:Lazarus@lazarus.freepascal.org">Lazarus@lazarus.freepascal.org</a><br>> <a href="http://www.lazarus.freepascal.org/mailman/listinfo/lazarus" target="_blank">http://www.lazarus.freepascal.org/mailman/listinfo/lazarus</a><br>
<br>_______________________________________________<br>Lazarus mailing list<br><a href="mailto:Lazarus@lazarus.freepascal.org">Lazarus@lazarus.freepascal.org</a><br><a href="http://www.lazarus.freepascal.org/mailman/listinfo/lazarus" target="_blank">http://www.lazarus.freepascal.org/mailman/listinfo/lazarus</a><br>
</div></div></blockquote></div><br></div>