Re: [twsocket] RcvdStream.Free with 404?

2009-05-17 Thread Francois Piette
>>> Should RcvdStream.Free still be called with HttpCli if a 404 error is
>>> received?

>>Is there something which makes you think it shouldn't ?

>I didn't know if there was data stored upon the occurrence of errors
> where standard data is not received, such as 404 errors, invalid
> authentication state, server too busy, etc.

It doesn't matter if any data is stored in any stream. Once it has been 
created, a stream or any other object has to be freed.
--
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

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


[twsocket] Errorcode 23396 when trying to use TSmtpCli in C++

2009-05-17 Thread Ole Braad-Sørensen
On Thu, 14 May 2009 10:31:53 +, you wrote:

>> 
>>> Possibly you need breaks? :-)
>>> 
>>> switch(RqType)
>>>  {
>>>   case smtpConnect:  SMTP->Helo(); break;
>>>   case smtpHelo: SMTP->MailFrom(); break;
>>>   case smtpEhlo: SMTP->Auth(); break;
>>>   case smtpAuth: SMTP->MailFrom(); break;
>>>   case smtpMailFrom: SMTP->RcptTo(); break;
>>>   case smtpRcptTo:   SMTP->Data(); break;
>>>   case smtpData: SMTP->Quit(); break;
>>>  }
>> 
>> No. Tried this too. 
>
>Really?

Yes, really :-)

>
>So please try again, it works fine with the breaks!  
> 

Maybe I did not explain myself thorough enouch, sorry!

The breaks has no effect in this case, as the error comes long before the breaks
will be at any use. Much code hes been made and you have not seen it all :-)

Made another try on another small project with the same result. See here:

First the "MailSendButton":

void __fastcall TForm2::ButtonClick(TObject *Sender)
{
SMTP->Host   = EditHost->Text;
SMTP->Port   = EditPort->Text;
SMTP->SignOn = EditSignOn->Text;
SMTP->FromName   = EditFromName->Text;
SMTP->HdrFrom= EditFromName->Text;
SMTP->HdrTo  = EditHdrTo->Text;
SMTP->HdrCc  = EditHdrCc->Text;
SMTP->HdrSubject = EditHdrSubject->Text;
SMTP->Username   = EditUserName->Text;
SMTP->Password   = EditPassword->Text;
SMTP->RcptName->Clear();
SMTP->RcptNameAdd(EditHdrTo->Text, EditHdrCc->Text, EditHdrBcc->Text);
Display("Connecting to mailserver");
SMTP->Connect();
}

And now the OnRequestdone:  (with breaks)  :-)

void __fastcall TForm2::SMTPRequestDone(TObject *Sender, TSmtpRequest RqType,
WORD ErrorCode)

{

> // When arriving to here from "Connect",
> // the RqType is = 0 and the ErrorCode is = 23396  - :-(
> // What is ErrorCode 23396 ?  (Guess it is not known)

 if (ErrorCode > 0 && ErrorCode < 1) {
  Display("RequestDone Rq=" + IntToStr(RqType) + " Error=" +
SMTP->ErrorMessage);
 } else {
  Display("RequestDone Rq=" + IntToStr(RqType) + " Error=" +
IntToStr(ErrorCode));
 }

 if (ErrorCode == 0) {
  switch(RqType)
   {
case smtpConnect:   SMTP->Helo();   break;
case smtpHelo:  SMTP->MailFrom();   break;
case smtpEhlo:  SMTP->Auth();   break;
case smtpAuth:  SMTP->MailFrom();   break;
case smtpMailFrom:  SMTP->RcptTo(); break;
case smtpRcptTo:SMTP->Data();   break;
case smtpData:  SMTP->Quit();   break;
case smtpQuit:  break;
   }
 }
}

As you see in the comments above, the switch is never reached :-(

The above program is a copy of the MailSnd example, which is in Delphi and works
great here. But in my "translation" to C++ it do not work. I may have missed
something or the SMTP thing don't work at all in C++.

Any suggestions...?

Regards:
Ole Braad-Sorensen
www.importshop.dk
-- 
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] Errorcode 23396 when trying to use TSmtpCli in C++

2009-05-17 Thread Arno Garrels
Ole Braad-Sørensen wrote:

> void __fastcall TForm2::SMTPRequestDone(TObject *Sender, TSmtpRequest
> RqType, WORD ErrorCode)
> 
> {
> 
>> // When arriving to here from "Connect",
>> // the RqType is = 0 and the ErrorCode is = 23396  - :-(
>> // What is ErrorCode 23396 ?  (Guess it is not known)

I have no idea? It's neither a winsock error nor a SMTP status code.
The only error number beyond 2 I am aware of is set by the 
component internally that is const smtpProtocolError = 20600;

Please show us what is returned (if anything) when you telnet the mail
server from the same machine from where you tried the C++ EXE.
Command prompt: "telnet  25".

> The above program is a copy of the MailSnd example, which is in
> Delphi and works great here. But in my "translation" to C++ it do not
> work. I may have missed something or the SMTP thing don't work at all
> in C++. 

Very strange! I just tested again with ICS-V7, CB2007 and CB2009 
successfully. 

--
Arno Garrels


-- 
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] Errorcode 23396 when trying to use TSmtpCli in C++

2009-05-17 Thread Fastream Technologies
Hello,

I saw similar problem with thttpcli and it went away when I "cleaned
and rebuilt" the ICS package.

Best Regards,

SZ

On 5/17/09, Ole Braad-Sørensen  wrote:
> On Thu, 14 May 2009 10:31:53 +, you wrote:
>
> >>
> >>> Possibly you need breaks? :-)
> >>>
> >>> switch(RqType)
> >>>  {
> >>>   case smtpConnect:  SMTP->Helo(); break;
> >>>   case smtpHelo: SMTP->MailFrom(); break;
> >>>   case smtpEhlo: SMTP->Auth(); break;
> >>>   case smtpAuth: SMTP->MailFrom(); break;
> >>>   case smtpMailFrom: SMTP->RcptTo(); break;
> >>>   case smtpRcptTo:   SMTP->Data(); break;
> >>>   case smtpData: SMTP->Quit(); break;
> >>>  }
> >>
> >> No. Tried this too.
> >
> >Really?
>
> Yes, really :-)
>
> >
> >So please try again, it works fine with the breaks!
> >
>
> Maybe I did not explain myself thorough enouch, sorry!
>
> The breaks has no effect in this case, as the error comes long before the 
> breaks
> will be at any use. Much code hes been made and you have not seen it all :-)
>
> Made another try on another small project with the same result. See here:
>
> First the "MailSendButton":
>
> void __fastcall TForm2::ButtonClick(TObject *Sender)
> {
>SMTP->Host   = EditHost->Text;
>SMTP->Port   = EditPort->Text;
>SMTP->SignOn = EditSignOn->Text;
>SMTP->FromName   = EditFromName->Text;
>SMTP->HdrFrom= EditFromName->Text;
>SMTP->HdrTo  = EditHdrTo->Text;
>SMTP->HdrCc  = EditHdrCc->Text;
>SMTP->HdrSubject = EditHdrSubject->Text;
>SMTP->Username   = EditUserName->Text;
>SMTP->Password   = EditPassword->Text;
>SMTP->RcptName->Clear();
>SMTP->RcptNameAdd(EditHdrTo->Text, EditHdrCc->Text, EditHdrBcc->Text);
>Display("Connecting to mailserver");
>SMTP->Connect();
> }
>
> And now the OnRequestdone:  (with breaks)  :-)
>
> void __fastcall TForm2::SMTPRequestDone(TObject *Sender, TSmtpRequest RqType,
> WORD ErrorCode)
>
> {
>
> > // When arriving to here from "Connect",
> > // the RqType is = 0 and the ErrorCode is = 23396  - :-(
> > // What is ErrorCode 23396 ?  (Guess it is not known)
>
>  if (ErrorCode > 0 && ErrorCode < 1) {
>  Display("RequestDone Rq=" + IntToStr(RqType) + " Error=" +
> SMTP->ErrorMessage);
>  } else {
>  Display("RequestDone Rq=" + IntToStr(RqType) + " Error=" +
> IntToStr(ErrorCode));
>  }
>
>  if (ErrorCode == 0) {
>  switch(RqType)
>   {
>case smtpConnect:   SMTP->Helo();   break;
>case smtpHelo:  SMTP->MailFrom();   break;
>case smtpEhlo:  SMTP->Auth();   break;
>case smtpAuth:  SMTP->MailFrom();   break;
>case smtpMailFrom:  SMTP->RcptTo(); break;
>case smtpRcptTo:SMTP->Data();   break;
>case smtpData:  SMTP->Quit();   break;
>case smtpQuit:  break;
>   }
>  }
> }
>
> As you see in the comments above, the switch is never reached :-(
>
> The above program is a copy of the MailSnd example, which is in Delphi and 
> works
> great here. But in my "translation" to C++ it do not work. I may have missed
> something or the SMTP thing don't work at all in C++.
>
> Any suggestions...?
>
> Regards:
> Ole Braad-Sorensen
> www.importshop.dk
-- 
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] THttpCli HEAD with body fix [subjectedited]

2009-05-17 Thread Fastream Technologies
Arno,

Instead of making a demo, I have a question and an idea: Please
examine the code below and read the comments:

procedure THttpCli.GetHeaderLineNext;
...

if {(FResponseVer = '1.0') or (FRequestVer = '1.0') or}
{ [rawbite 31.08.2004 Connection controll] }
FCloseReq then begin
if FLocationFlag then  { Added 16/02/2004 }
StartRelocation{ Added 16/02/2004 }
else begin { Added 16/02/2004 }
if FRequestType = httpHEAD then begin { Added 23/07/04 }
{ With HEAD command, we don't expect a document }
{ but some server send one !}
FReceiveLen := 0;  { Cancel received data   }
StateChange(httpWaitingBody);
FNext := nil;
end;
FCtrlSocket.CloseDelayed;  { Added 10/01/2004 THIS
WORKS PERFECTLY BUT..}
end;
end
else if FRequestType = httpHEAD then begin//AG 05/27/08
{ With HEAD command, we don't expect a document } //AG 05/27/08
{ but some server send one !} //AG 05/27/08
FReceiveLen := 0;  { Cancel received data   } //AG 05/27/08
StateChange(httpWaitingBody); //AG 05/27/08
FNext := nil; //AG 05/27/08
SetReady; //AG
05/27/08 WHY IS THIS? INSTEAD I PROPOSE:
FCtrlSocket.CloseDelayed;  { Added 05/17/2009 Fastream
/ Subzero }
end   //AG 05/27/08

This solves my problem. If it is ok for you as well, please apply this
fix to the component.

Best Regards,

SZ

On 5/16/09, Arno Garrels  wrote:
> Fastream Technologies wrote:
> > Hello Arno,
> >
> > The reason is when the state is httpReady, it is not yet ready in some
> > cases, that is a misleading state machine state (IMHO).
>
> If that's so clear, why don't you provide a simple test case that shows
> the issue in actions?
>
> >
> > ASAP I will try the postmessage and let you know if it is ok for my
> > case here. I believe I did this a few weeks ago but not sure so will
> > retry in case...
>
> That won't tell me anything really useful, regardless whether your
> application worked after this change or not.
>
> --
>
> Arno Garrels
>
> --
-- 
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


[twsocket] Errorcode 23396 when trying to use TSmtpCli in C++

2009-05-17 Thread Ole Braad-Sørensen
On Sun, 17 May 2009 11:32:30 +, you wrote:

>I saw similar problem with thttpcli and it went away when I "cleaned
>and rebuilt" the ICS package.

Isn't life strange. I just updated using SVN, cleaned, rebuilt and installed the
ICS package.

Would you believe it. Now I don't get the errorcode 23396 anymore...!
It has changed to ErrorCode = 61582.

Sad enough, this don't help much. Maybe another compile will show something
different. At last I could get lucky and getting the whole thing working. But
maybe just after some years. Better waiting for the next "Indy" update... :-(

Regards:
Ole Braad-Sorensen
www.importshop.dk
-- 
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


[twsocket] Errorcode 23396 when trying to use TSmtpCli in C++

2009-05-17 Thread Ole Braad-Sørensen
On Sun, 17 May 2009 11:32:30 +, you wrote:

>Please show us what is returned (if anything) when you telnet the mail
>server from the same machine from where you tried the C++ EXE.
>Command prompt: "telnet  25".

The server responds with:
220 apollon.soholm.com ESMTP Sendmail 8.13.2 (and so on)

When I type: ehlo soholm.com it responds with:
250-apollon.soholm.com Hello [192.168.1.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-DELIVERY
250-HELP

When I type: helo soholm.com it responds with:
250-apollon.soholm.com Hello [192.168.1.1], pleased to meet you

The answers do not match the errors I get from my program, no? :-)

Using telnet I can send a message. But a but "clumsy"...!

Regards:
Ole Braad-Sorensen
www.importshop.dk
-- 
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] RcvdStream.Free with 404?

2009-05-17 Thread x x
Right. I understand it eventually must be cleared. I should have been
more thorough with my question:
When multiple GET requests are performed simultaneously, should
RcvdStream.Free still be called in OnRequestDone when errors such as 404
are received?


<-Original Message-> 
>From: Francois Piette [francois.pie...@skynet.be]
>Sent: 5/17/2009 2:02:27 AM
>To: twsocket@elists.org
>Subject: Re: [twsocket] RcvdStream.Free with 404?
>
 Should RcvdStream.Free still be called with HttpCli if a 404 error
is
 received?
>
>>>Is there something which makes you think it shouldn't ?
>
>>I didn't know if there was data stored upon the occurrence of errors
>> where standard data is not received, such as 404 errors, invalid
>> authentication state, server too busy, etc.
>
>It doesn't matter if any data is stored in any stream. Once it has been
>created, a stream or any other object has to be freed.
>--
>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
>
>-- 
>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
>.
> 


___Get
 the Free email that has everyone talking at http://www.mail2world.com 
target=new>http://www.mail2world.com  Unlimited 
Email Storage – POP3 – Calendar – SMS – Translator – 
Much More!
-- 
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] Errorcode 23396 when trying to use TSmtpCli in C++

2009-05-17 Thread Arno Garrels
Ole Braad-Sørensen wrote:
> On Sun, 17 May 2009 11:32:30 +, you wrote:
> 
>> I saw similar problem with thttpcli and it went away when I "cleaned
>> and rebuilt" the ICS package.
> 
> Isn't life strange. I just updated using SVN, cleaned, rebuilt and
> installed the ICS package.
> 
> Would you believe it. Now I don't get the errorcode 23396 anymore...!
> It has changed to ErrorCode = 61582.
> 
> Sad enough, this don't help much. Maybe another compile will show
> something different. At last I could get lucky and getting the whole
> thing working. But maybe just after some years. Better waiting for
> the next "Indy" update... :-( 

All I can say is that it is working nicely with BCB in my little test
application. The problem must be IMO something on your side. 
You can sent me your project if you like by PM so I can test it with my
clean ICS installation. If the mail server is public please send me
its address as well.   

> 
> Regards:
> Ole Braad-Sorensen
> www.importshop.dk
-- 
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