Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2008-09

Asyncronous socket error lNet

5 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Usuario Anónimo

I get an asyncronous socket error.

This is my code.

procedure TForm1.Button1Click(Sender: TObject);
var
  Item: string;
begin
  System.Assign(DataModule1.ItemFile,'items.txt');
  System.Reset(DataModule1.ItemFile);
  repeat
    System.Read(DataModule1.ItemFile,Item);
DataModule1.LTCPComponent1.SendMessage(Item,DataModule1.LTCPComponent1.Iterator);
  until EOF(DataModule1.ItemFile);
  System.Close(DataModule1.ItemFile);
end;

Why?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20080928/fe421557/attachment.html

Reply by email

Howard Page-Clark
to Usuario Anónimo

Usuario An?nimo wrote

Show quoted text 17 lines
I get an asyncronous socket error. This is my code. procedure TForm1.Button1Click(Sender: TObject); var Item: string; begin System.Assign(DataModule1.ItemFile,'items.txt'); System.Reset(DataModule1.ItemFile); repeat System.Read(DataModule1.ItemFile,Item); DataModule1.LTCPComponent1.SendMessage(Item,DataModule1.LTCPComponent1.Iterator); until EOF(DataModule1.ItemFile); System.Close(DataModule1.ItemFile); end;

I don't know what a LTCPComponent is. But you could try replacing your repeat ... until loop with: while not EOF(DataModule1.ItemFile)

      begin
      ...
      end;

Howard

Reply by email

Aleš Katona
to Usuario Anónimo: I get an asyncronous socket error. This is my code. procedure TForm1.Button1Click(Sender:…

D?a Ne, 2008-09-28 o 20:14 +0200, Usuario An?nimo nap?sal:

Show quoted text 19 lines
I get an asyncronous socket error. This is my code. procedure TForm1.Button1Click(Sender: TObject); var Item: string; begin System.Assign(DataModule1.ItemFile,'items.txt'); System.Reset(DataModule1.ItemFile); repeat System.Read(DataModule1.ItemFile,Item); DataModule1.LTCPComponent1.SendMessage(Item,DataModule1.LTCPComponent1.Iterator); until EOF(DataModule1.ItemFile); System.Close(DataModule1.ItemFile); end; Why?

You need to check if .Send or .SendMessage in your case don't return 0. If so either an error on the network occurred (reported by OnError event), or the OS send buffer is full and you need to use the OnCanSend event. For more info on sending big data see:
http://lnet.wordpress.com/usage/sockets-protocols-and-sending/

Btw. is DataModule now working properly in Lazarus? Last I tried it's things weren't visible in the OI on other units of the project.

Ales

_______________________________________________ Lazarus mailing list http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Michael Van Canneyt
to Aleš Katona
Show quoted text 33 lines
On Mon, 29 Sep 2008, Ale? Katona wrote: > D?a Ne, 2008-09-28 o 20:14 +0200, Usuario An?nimo nap?sal: > I get an asyncronous socket error. > > This is my code. > > procedure TForm1.Button1Click(Sender: TObject); > var > Item: string; > begin > System.Assign(DataModule1.ItemFile,'items.txt'); > System.Reset(DataModule1.ItemFile); > repeat > System.Read(DataModule1.ItemFile,Item); > > DataModule1.LTCPComponent1.SendMessage(Item,DataModule1.LTCPComponent1.Iterator); > until EOF(DataModule1.ItemFile); > System.Close(DataModule1.ItemFile); > end; > > Why? You need to check if .Send or .SendMessage in your case don't return 0. If so either an error on the network occurred (reported by OnError event), or the OS send buffer is full and you need to use the OnCanSend event. For more info on sending big data see: http://lnet.wordpress.com/usage/sockets-protocols-and-sending/ Btw. is DataModule now working properly in Lazarus? Last I tried it's things weren't visible in the OI on other units of the project.

It works properly.

Michael.

Reply by email

Usuario Anónimo
to Aleš Katona: D?a Ne, 2008-09-28 o 20:14 +0200, Usuario An?nimo nap?sal: You need to check if .Send or…

I can?t fill the buffer, SendMessage never returns 0. Why?

My code:

procedure TForm1.Button1Click(Sender: TObject);
var
  Buffer: string;
  Sent: integer;
begin
  Buffer := 'START???END'; // ?> 1198469 characters
  Sent := LTCPComponent1.SendMessage(Buffer,LTCPComponent1.Iterator);
  if Sent = 0 then
    ShowMessage('Buffer full')
  else
    ShowMessage(IntToStr(Sent)); // ?> Show 1198469
end;

Best regards!

2008/9/29 Ale? Katona

Show quoted text 42 lines
D?a Ne, 2008-09-28 o 20:14 +0200, Usuario An?nimo nap?sal: > I get an asyncronous socket error. > > This is my code. > > procedure TForm1.Button1Click(Sender: TObject); > var > Item: string; > begin > System.Assign(DataModule1.ItemFile,'items.txt'); > System.Reset(DataModule1.ItemFile); > repeat > System.Read(DataModule1.ItemFile,Item); > > DataModule1.LTCPComponent1.SendMessage(Item,DataModule1.LTCPComponent1.Iterator); > until EOF(DataModule1.ItemFile); > System.Close(DataModule1.ItemFile); > end; > > Why? You need to check if .Send or .SendMessage in your case don't return 0. If so either an error on the network occurred (reported by OnError event), or the OS send buffer is full and you need to use the OnCanSend event. For more info on sending big data see: http://lnet.wordpress.com/usage/sockets-protocols-and-sending/ Btw. is DataModule now working properly in Lazarus? Last I tried it's things weren't visible in the OI on other units of the project. Ales > _______________________________________________ > Lazarus mailing list > > http://www.lazarus.freepascal.org/mailman/listinfo/lazarus _______________________________________________ Lazarus mailing list http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20080929/9942bd92/attachment.html

Reply by email