I don't see anything obviously wrong there.
Just to be sure, please test one of the sample programs (For example 
OverbyteIcsClient7.dproj which is close to your own test) delivered with ICS to 
see if they works OK. If not, then you have somehow corrupted your ICS 
installation.


-- 
francois.pie...@overbyte.be
Embarcadero MVP
http://www.overbyte.be


-----Message d'origine-----
De : twsocket-boun...@elists.org [mailto:twsocket-boun...@elists.org] De la 
part de LeNif
Envoyé : mercredi 24 octobre 2012 07:55
À : twsocket
Objet : Re: [twsocket] TWsocket and EStackOverflow

Hello,

When I say "wait", it 's because, I look at my debug memo and I don't click on 
connect before the event OnsessionClosed is fired, I manually wait with my eyes 
! ;) Idon't use the wait() procedure !

I make a copy paste of my source code, as you can see, it's really simple: (I 
just suppress each event code where there is just a debug lines added to the 
memo to see if event is fired)

procedure TForm1.Button2Click(Sender: TObject); begin // start or stop  if 
TCPCLient.State = wsClosed then
   TCPClient.Connect
 else
   TCPClient.close;
end;

procedure TForm1.Button3Click(Sender: TObject); begin
  TCPClient.SendStr(CHR($21));
end;

procedure TForm1.Button4Click(Sender: TObject); begin
  TCPClient.SendStr(CHR($55));
end;

procedure TForm1.dvLed1Change(Sender: TObject); begin // event fired by a led 
displaying connection status
  If dvLed1.LedOn then
    Button2.Caption := 'Disconnect'
  else Button2.Caption := 'Connect'
end;

procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean); begin
  TCPClient.Close;
end;

Procedure TForm1.LogIt(AMessage: string); begin
  meLog.Lines.Add(Amessage);
end;

procedure TForm1.TCPClientDataAvailable(Sender: TObject; ErrCode: Word); var
    Buffer, hexBuf : array [0..1023] of char;
    Len    : Integer;
    Src    : TSockAddrIn;
    SrcLen : Integer;
    hexstr: String;
begin
  LogIt('DataAvalaible: Error='+IntToStr(ErrCode));
  SrcLen := SizeOf(Src);
  Len    := TCPClient.ReceiveFrom(@Buffer, SizeOf(Buffer), Src, SrcLen);
  if Len >= 0 then
  begin
    LogIt('Data from '+StrPas(inet_ntoa(Src.sin_addr))+' - data : ' + 
(strpas(Buffer)));
  end;
end;

procedure TForm1.TCPClientSessionClosed(Sender: TObject; ErrCode: Word); begin
  logIt('SessionClosed: Error='+IntToStr(ErrCode));
  dvLed1.LedOn := False;
end;

procedure TForm1.TCPClientSessionConnected(Sender: TObject; ErrCode: Word); 
begin
  logIt('SessionConnected: Error='+IntToStr(ErrCode));
  dvLed1.LedOn := True;
end;





LeNif

From: François Piette
Date: 2012-10-23 18:39
To: 'ICS support mailing'
Subject: Re: [twsocket] TWsocket and EStackOverflow
> Hello, thanks but I already wait for OnsessionClosed befor restarting. 

"Wait" ? Does this means you don't use the events ?

> I post a capture with log info here ... 
> http://imageshack.us/photo/my-images/844/screenshot47a.png/

Not very interesting...
If you have a stack overflow, you probably have a function calling itself 
recursively. Your "wait" is probably the culprit but in fact, I don't know 
because I have no idea about your code. Did you have a look at the sample 
programs ?

--
francois.pie...@overbyte.be
Embarcadero MVP
http://www.overbyte.be



--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to