Re: [twsocket] OnSessionClosed

2007-02-14 Thread Wilfried Mestdagh
Hello Markus,

This is how TCP works. OnSessionClosed is fired when the other end say
"Goodbye", or when you try to send something and the other end is not
their anymore. There is no traffic if there is no data send, so TCP
layer cannot know if for example cable is plugged out.

So you have to do something lik Michael proposed. Implement keep alive
packets in your protocol if you need to know.

---
Rgds, Wilfried [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html
http://www.mestdagh.biz

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


Re: [twsocket] OnSessionClosed

2007-02-14 Thread Kochendoerfer, Michael
Markus,

why not implementing some kind of NOOP over the protocol? Means that your 
client's sending some special small data packets over the line which the server 
simply drops, only if transfer is idle and possibly timer based?

Michael

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED]
> Behalf Of [EMAIL PROTECTED]
> Sent: Wednesday, February 14, 2007 3:38 PM
> To: twsocket@elists.org
> Subject: [twsocket] OnSessionClosed
> 
> 
> Hello,
> 
> strange problem here:
> 
> - two PCs connected via normal LAN
> - one runs my server app (simple TWSocket since the server 
> only has to handle one connection)
> - the other one runs my client app (twsocket as well)
> - the connection is a TCP connection
> 
> Normal communication is fine. I've assigned OnSessionClosed 
> on both server and client side.
> If I plug out the cable the server side detects the 
> OnSessionClosed, but not the client side!
> 
> This also happens with the included demo programs Client5 and 
> TCPSvr. The server will recognize 
> the lost connection but not the client. Since I'd like to 
> reestablish that connection if there 
> hasn't been a request of my client program to close the 
> connection (I've implemented something 
> for that in my protocol) I need to know on the client side 
> when the connection is lost!
> 
> What's wrong here?
> 
> Greetings
> 
> Markus
> 
> 
> ebm-papst St. Georgen GmbH & Co. KG 
> Kommanditgesellschaft Sitz St. Georgen 
> Amtsgericht Freiburg HRA 601094 
> Persoenlich haftende Gesellschafterin: 
> Papst-Motoren GmbH, Sitz St. Georgen 
> Amtsgericht Freiburg HRB 600163
> Geschaeftsfuehrer: Dr. Gerhard Lahm, Thomas Wagner 
> 
> 
> -- 
> To unsubscribe or change your settings for TWSocket mailing list
> please goto http://www.elists.org/mailman/listinfo/twsocket
> Visit our website at http://www.overbyte.be
> 
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


[twsocket] OnSessionClosed

2007-02-14 Thread Markus . Humm
Hello,

strange problem here:

- two PCs connected via normal LAN
- one runs my server app (simple TWSocket since the server only has to handle 
one connection)
- the other one runs my client app (twsocket as well)
- the connection is a TCP connection

Normal communication is fine. I've assigned OnSessionClosed on both server and 
client side.
If I plug out the cable the server side detects the OnSessionClosed, but not 
the client side!

This also happens with the included demo programs Client5 and TCPSvr. The 
server will recognize 
the lost connection but not the client. Since I'd like to reestablish that 
connection if there 
hasn't been a request of my client program to close the connection (I've 
implemented something 
for that in my protocol) I need to know on the client side when the connection 
is lost!

What's wrong here?

Greetings

Markus


ebm-papst St. Georgen GmbH & Co. KG 
Kommanditgesellschaft Sitz St. Georgen 
Amtsgericht Freiburg HRA 601094 
Persoenlich haftende Gesellschafterin: 
Papst-Motoren GmbH, Sitz St. Georgen 
Amtsgericht Freiburg HRB 600163
Geschaeftsfuehrer: Dr. Gerhard Lahm, Thomas Wagner 


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


Re: [twsocket] Memory Leak in SmtpProt

2007-02-14 Thread Arno Garrels
Veit Zimmermann wrote:
> Arno,
> 
> That might be true. By the way: Wouldn't the following be sufficient?
> It should be much faster:
> 
>  if FMailMessage.Count > 0 then

Yes, please have a look at latest SmtpProt.pas, FMailMsg.Text is
now copied once to a string variable named FMailMsgText. Message
text is encoded/wrapped on the fly so this string is to be read
many many times.

> 
> When will the next beta come out? Is there a time line? I know
> Francois is busy. Is he controlling releases alone or are others
> (like you) helping him on this? 

Francois is controlling releases on his own.

> Because there is this other issue
> of which I'm not sure how important it is (see article: bug in
> smtpprot.pas by Marcello Vezzelli and its follow-ups) with at
> least two issues concerning RFC822DateTime.

Yes, this is a small bug and needs to be fixed, I think 
'hh":"nn":"ss' is OK. 

---
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html


> 
> Veit
> 
> 
> Arno Garrels wrote:
>> Veit,
>> 
>> You are not using latest Beta downloads.
>> 
>> ---
>> Arno Garrels [TeamICS]
>> http://www.overbyte.be/eng/overbyte/teamics.html
>> 
>> 
>> Veit Zimmermann wrote:
>>> Hi
>>> 
>>> It seems that there is a memory leak in SmtpProt:
>>> When sending an email and using MailMessage for including the
>>> text of the mail, the text is compared with an empty string with
>>> the GetText method of TStrings. This method creates a copy of
>>> the MailMessage TStrings which is not freed again:
>>> 
>>>  {if Length(FMailMessage.Text) > 0 then} { FP 05/03/06 }
>>>  if FMailMessage.GetText^ <> #0 then
>>>  FMailMsgTextPos := 1
>>>  else
>>>  FMailMsgTextPos := 0;
>>> 
>>> As you can Francois has already included a Fix. Why is this fix
>>> only a comment?
>>> 
>>> Veit
> 
> 
> --
> *
> * Dipl.-Ing. Veit Zimmermann [EMAIL PROTECTED] *
> * VECTRONIC Aerospace GmbH  www.vectronic-aerospace.com *
> * Carl-Scheele-Str. 12 tel: +49 (0)30 6789 4990 *
> * D-12489 Berlin   fax: +49 (0)30 6789 5230 *
> * Germany  WGS84: 52°25.83'N 13°31.52'E *
> *
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] bug in smtpprot.pas

2007-02-14 Thread Veit Zimmermann
Hi Arnaldo

If you look at the source of FormatDateTime M is replaced by N if the
preceding formatting character is H. I'm not quite sure if this works
correctly, it won't hurt to change it to "nn" anyway.


All:
I checked FormatDateTime routines and they are all the same (regarding
speed).

So a call like
Result := DateToStr (t, RFC822_FormatSettings) + ' '
+ Time(t,RFC822_FormatSettings) + ' '
+ TimeZoneBias

with the following constant

   RFC822_FormatSettings : TFormatSettings = (
 CurrencyFormat:3;
 NegCurrFormat: 8;
 ThousandSeparator: ',';
 DecimalSeparator:  '.';
 CurrencyDecimals:  2;
 DateSeparator: '.';
 TimeSeparator: ':';
 ListSeparator: ';';
 CurrencyString:'€';
 ShortDateFormat:   'dd.MM.';
 LongDateFormat:'ddd, d mmm  hh:nn:ss';
 TimeAMString:  '';
 TimePMString:  '';
 ShortTimeFormat:   'hh:nn:ss';
 LongTimeFormat:'hh:nn:ss';
 ShortMonthNames:   ('Jan', 'Feb', 'Mar', 'Apr', 'May', 
'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
 LongMonthNames:('January', 'February', 'March', 
'April', 'May', 'June', 'July', 'Augut', 'September', 'October', 
'November', 'December');
 ShortDayNames: ('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 
'Fri', 'Sat');
 LongDayNames:  ('Sunday', 'Monday', 'Tuesday', 
'Wednesday', 'Thursday', 'Friday', 'Saturday');
 TwoDigitYearCenturyWindow: 0;);

would be easier to read.
Moreover according to Delphi Help it would be thread save in opposition
to a call without a TFormatSettings parameter.

Veit

Arnaldo Braun wrote:
> Hi
> 
> A small typo in
> 
> hh:mm:ss
> 
> must be corrected to
> 
> hh:nn:ss or hh":"nn":"ss
> 
> MM is month and NN is minute
> 
> 
> 
> 
> Veit Zimmermann wrote:
> 
>> Marcello Vezzelli wrote:
>>  
>>
>>> Hi all,
>>> there is a bug in SmtpProt.pas (latest ics version just downloaded),
>>> function Rfc822DateTime, line 2892 and 2907, FormatDateTime function.
>>>
>>>Result := FormatDateTime('ddd, d mmm  hh:mm:ss', t) +
>>>  ' ' + TimeZoneBias
>>>
>>> The time separator : should be put between double quotes, like this:
>>>
>>>Result := FormatDateTime('ddd, d mmm  hh":"mm":"ss', t) +
>>>  ' ' + TimeZoneBias
>>>
>>> Otherwise the system default time separator would be used (in italian
>>> localization, default time separator is '.').
>>>
>>> Regards
>>>
>>>
>> I know this comes a little bit late, but...
>>
>> In the same function it is tested for English/US format by only
>> comparing the first day (Sunday). Does anyone know if there is
>> any other language where the Sunday is also abbreviated as "sun"
>> but other days or months differ?
>>
>> if ShortDayNames[1] = MyShortDayNames[1] then
>> Result := FormatDateTime('ddd, d mmm  hh":"mm":"ss', t) +
>>   ' ' + TimeZoneBias
>>
>> Francois, why do you test at all and don't use TFormatSettings
>> for all those functions? Is it performance? I don't know if the
>> overloaded FormatDateTime function with TFormatStettings is slower.
>> At least it makes the code much more readable and shorter (despite
>> the definition of the TFormatSettings as a constant).
>>
>>  Veit
>>  
>>
> 


-- 
*
* Dipl.-Ing. Veit Zimmermann [EMAIL PROTECTED] *
* VECTRONIC Aerospace GmbH  www.vectronic-aerospace.com *
* Carl-Scheele-Str. 12 tel: +49 (0)30 6789 4990 *
* D-12489 Berlin   fax: +49 (0)30 6789 5230 *
* Germany  WGS84: 52°25.83'N 13°31.52'E *
*
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Memory Leak in SmtpProt

2007-02-14 Thread Veit Zimmermann
Arno,

That might be true. By the way: Wouldn't the following be sufficient?
It should be much faster:

 if FMailMessage.Count > 0 then

When will the next beta come out? Is there a time line? I know
Francois is busy. Is he controlling releases alone or are others
(like you) helping him on this? Because there is this other issue
of which I'm not sure how important it is (see article: bug in
smtpprot.pas by Marcello Vezzelli and its follow-ups) with at
least two issues concerning RFC822DateTime.

Veit


Arno Garrels wrote:
> Veit,
> 
> You are not using latest Beta downloads.
> 
> ---
> Arno Garrels [TeamICS]
> http://www.overbyte.be/eng/overbyte/teamics.html
> 
> 
> Veit Zimmermann wrote:
>> Hi
>>
>> It seems that there is a memory leak in SmtpProt:
>> When sending an email and using MailMessage for including the
>> text of the mail, the text is compared with an empty string with
>> the GetText method of TStrings. This method creates a copy of
>> the MailMessage TStrings which is not freed again:
>>
>>  {if Length(FMailMessage.Text) > 0 then} { FP 05/03/06 }
>>  if FMailMessage.GetText^ <> #0 then
>>  FMailMsgTextPos := 1
>>  else
>>  FMailMsgTextPos := 0;
>>
>> As you can Francois has already included a Fix. Why is this fix
>> only a comment?
>>
>> Veit


-- 
*
* Dipl.-Ing. Veit Zimmermann [EMAIL PROTECTED] *
* VECTRONIC Aerospace GmbH  www.vectronic-aerospace.com *
* Carl-Scheele-Str. 12 tel: +49 (0)30 6789 4990 *
* D-12489 Berlin   fax: +49 (0)30 6789 5230 *
* Germany  WGS84: 52°25.83'N 13°31.52'E *
*
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Memory Leak in SmtpProt

2007-02-14 Thread Arno Garrels
Veit,

You are not using latest Beta downloads.

---
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html


Veit Zimmermann wrote:
> Hi
> 
> It seems that there is a memory leak in SmtpProt:
> When sending an email and using MailMessage for including the
> text of the mail, the text is compared with an empty string with
> the GetText method of TStrings. This method creates a copy of
> the MailMessage TStrings which is not freed again:
> 
>  {if Length(FMailMessage.Text) > 0 then} { FP 05/03/06 }
>  if FMailMessage.GetText^ <> #0 then
>  FMailMsgTextPos := 1
>  else
>  FMailMsgTextPos := 0;
> 
> As you can Francois has already included a Fix. Why is this fix
> only a comment?
> 
> Veit
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be