Re: [twsocket] TWsocket and EStackOverflow

2012-10-24 Thread François Piette
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

Re: [twsocket] TWsocket and EStackOverflow

2012-10-24 Thread LeNif
Hello,

When I use Wireshark to snif communication, I see that exchange with the device 
continue, even after the close  that's really strange ...

Maybe the problem is with the device and not with my socket ...

thanks




LeNif

From: François Piette
Date: 2012-10-24 20:14
To: 'ICS support mailing'
Subject: Re: [twsocket] TWsocket and EStackOverflow
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
--
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

Re: [twsocket] TWsocket and EStackOverflow

2012-10-24 Thread François Piette
You should try using Shutdown instead of closing your end. Shutdown ask the 
other party to close the connection and you receive the sessionclosed event 
when he accept. If you don't receive sessionclosed event, then you may call 
Abort.

Shutdown is a graceful close (one partu ask the other to break the connection), 
Abort is an immediate termination of the connection whatever the other party 
want.

--
francois.pie...@overbyte.be
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
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 20:29
À : twsocket
Objet : Re: [twsocket] TWsocket and EStackOverflow

Hello,

When I use Wireshark to snif communication, I see that exchange with the device 
continue, even after the close  that's really strange ...

Maybe the problem is with the device and not with my socket ...

thanks




LeNif

From: François Piette
Date: 2012-10-24 20:14
To: 'ICS support mailing'
Subject: Re: [twsocket] TWsocket and EStackOverflow 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
--
To unsubscribe or change your settings for 

[twsocket] Plans for ICS and iOS?

2012-10-24 Thread Hoby Smith
Hello.

 

Now that ICS supports both Windows and MAC OS X via FireMonkey (FM2), do you
have any plans to support iOS targets in the future as well?  Or, are you
waiting for the future XE3/4/5.2 or whatever that will eventually include
the new native non-Win target compilers?

 

Thanks much. and you guys are awesome!  J

 

Hoby

--
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


Re: [twsocket] Plans for ICS and iOS?

2012-10-24 Thread Arno Garrels
Hoby Smith wrote:

 Now that ICS supports both Windows and MAC OS X via FireMonkey (FM2),
 do you have any plans to support iOS targets in the future as well? 
 Or, are you waiting for the future XE3/4/5.2 or whatever that will
 eventually include the new native non-Win target compilers?

That was my plan last year, but then EMB crippled Delphi for their 
NextGen compiler IMO. Looking at XE3's source code it becomes clear
that there will be no more Pointers, only one string type etc.. in
NextGen which seemed to be required for their already announced mobil
studio. So I for one gave up that plan, (no Pointers = no Arno coding 
ICS/Delphi).

-- 
Arno  
--
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


Re: [twsocket] TWsocket and EStackOverflow

2012-10-24 Thread LeNif
Hello Francois,

I already try, after reading the Wiki, the Shutdown(1) procedure, anyway, the 
result is the same. I try close, shutdown, abort ... etc.

Every time, the sessionclosed is fired and when I reconnect I get 
EStackOverflow ! If I close the apps and restart, the connect is working. Maybe 
I must use a runtime created socket to solve this behaviour ?

Thanks F.




LeNif

From: François Piette
Date: 2012-10-24 21:22
To: 'ICS support mailing'
Subject: Re: [twsocket] TWsocket and EStackOverflow
You should try using Shutdown instead of closing your end. Shutdown ask the 
other party to close the connection and you receive the sessionclosed event 
when he accept. If you don't receive sessionclosed event, then you may call 
Abort.

Shutdown is a graceful close (one partu ask the other to break the connection), 
Abort is an immediate termination of the connection whatever the other party 
want.

--
francois.pie...@overbyte.be
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
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 20:29
À : twsocket
Objet : Re: [twsocket] TWsocket and EStackOverflow

Hello,

When I use Wireshark to snif communication, I see that exchange with the device 
continue, even after the close  that's really strange ...

Maybe the problem is with the device and not with my socket ...

thanks




LeNif

From: François Piette
Date: 2012-10-24 20:14
To: 'ICS support mailing'
Subject: Re: [twsocket] TWsocket and EStackOverflow 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 

Re: [twsocket] TWsocket and EStackOverflow

2012-10-24 Thread Arno Garrels
LeNif wrote:
 I already try, after reading the Wiki, the Shutdown(1) procedure,
 anyway, the result is the same. I try close, shutdown, abort ... etc. 

Try the following:
From the OnSessionClosed event handler post a custom window 
message and reconnect when that message is handled.

-- 
Arno

--
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