 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Jonathan Benedicto Guest
|
Posted: Tue Feb 15, 2005 10:29 pm Post subject: tcp server |
|
|
How do I send buffers/RFC replies etc. using a Indy IdTCPServer outside of a
OnConnect / OnDisconnect / OnExecute handler ?
--
Jonathan
|
|
| Back to top |
|
 |
Jonathan Benedicto Guest
|
Posted: Tue Feb 15, 2005 10:40 pm Post subject: Re: tcp server |
|
|
Thank you very much for this help. I am still learning how to use the Indy
components after using the TServerSocket and TClientSocket for a long while.
--
Jonathan
"Remy Lebeau (TeamB)" <no.spam (AT) no (DOT) spam.com> wrote
| Quote: |
"Jonathan Benedicto" <incorrect (AT) no (DOT) server> wrote in message
news:421277be$1 (AT) newsgroups (DOT) borland.com...
How do I send buffers/RFC replies etc. using a Indy IdTCPServer
outside of a OnConnect / OnDisconnect / OnExecute handler ?
Use the server's Threads property to access the active TIdPeerThread
instances. It is your own responsibility to identify which thread you
need
to access from the list.
Gambit
|
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Tue Feb 15, 2005 10:42 pm Post subject: Re: tcp server |
|
|
"Jonathan Benedicto" <incorrect (AT) no (DOT) server> wrote
| Quote: | How do I send buffers/RFC replies etc. using a Indy IdTCPServer
outside of a OnConnect / OnDisconnect / OnExecute handler ?
|
Use the server's Threads property to access the active TIdPeerThread
instances. It is your own responsibility to identify which thread you need
to access from the list.
Gambit
|
|
| Back to top |
|
 |
Mr. Wuf Guest
|
Posted: Sun Feb 05, 2006 12:27 am Post subject: Re: Bare LFs in SMTP |
|
|
Thank you very much for your help, Remy (or Gambit?). You are the best!
I will try it again in some days again.
Best regards,
Wuf |
|
| Back to top |
|
 |
Peter Evans Guest
|
Posted: Wed Feb 08, 2006 12:00 pm Post subject: Re: URLEncode and Unicode |
|
|
"Hamid" wrote in message news:43dc6a15$1 (AT) newsgroups (DOT) borland.com...
| Quote: |
I'm using TNMURL to encode a url, but seemingly the component fails to
encode urls containing Unicode characters. How can I solve the problem?
Thanx
Hamid, |
I made the following work OK, but it uses CppWebBrowser1->Navigate, from
NetMasters, to pull the page in !
//make wide string from the URL that has been read in from
file
//get space, and calc length
wchar_t wcURL[256+1]; int iURL=2*strlen((const
char*)csURL)+1;
//
//change to wide / BSTR
StringToWideChar((String)csURL,wcURL,iURL);
//
//load down the first page of the website
CppWebBrowser1->Navigate(wcURL);
Incidentally, the following seems to work without problem as well:
CppWebBrowser1->Navigate(L"AnyPieceOfGoodHtml.html");
Hope that helps.
Best regards,
Peter Evans. |
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Wed Feb 08, 2006 7:05 pm Post subject: Re: URLEncode and Unicode |
|
|
"Peter Evans" <peter-evans (AT) pelcaro (DOT) com> wrote in message
news:43e9cfd9$1 (AT) newsgroups (DOT) borland.com...
| Quote: | I made the following work OK, but it uses CppWebBrowser1->Navigate,
from NetMasters, to pull the page in !
|
TCppWebBrowser is not a NetMasters component. It is a Borland component
wrapper around the Internet Explorer COM object.
| Quote: | //make wide string from the URL that has been read in
from file
//get space, and calc length
wchar_t wcURL[256+1]; int iURL=2*strlen((const
char*)csURL)+1;
//
//change to wide / BSTR
StringToWideChar((String)csURL,wcURL,iURL);
//
//load down the first page of the website
CppWebBrowser1->Navigate(wcURL);
|
There is an easier way to do that:
CppWebBrowser1->Navigate(WideString(csURL));
| Quote: | Incidentally, the following seems to work without problem as well:
CppWebBrowser1->Navigate(L"AnyPieceOfGoodHtml.html");
|
That is very dangerous. Navigate() expects a BSTR. Using the 'L' keyword
*does not* produce a valid BSTR. All the 'L' keyword does is to tell the
compiler to create a wchar_t* constant instead of a char* constant. A BSTR,
on the other hand, is more than that. It has a 4-byte length value
preceeding the character memory. The 'L' keyword cannot produce that. You
need to use one of the Win32 API's SysAlloc...() functions (which are
wrapped by the WideString class) to produce valid BSTR values.
Gambit |
|
| Back to top |
|
 |
Hans Galema Guest
|
Posted: Thu Feb 09, 2006 2:03 pm Post subject: Re: Bare LFs in SMTP |
|
|
Mark Jacobs wrote:
| Quote: | Remy, even the simplified code is overly complicated. An email component
is supposed to hold your hand, not bite it off! This is why I steer
clear of Indy, and program at ClientSocket level - my code is much cleaner.
|
All is about the interface which should be simple.
How about this this ?
TMyMail *MyMail = new TMyMail;
MyMail->PlainText = ...; //TStrings or filename
MyMail->HtmlText = ...; //TStrings or filename
MyMail->AddInlineAttachment ( inlinefilename1 )
MyMail->AddInlineAttachment ( inlinefilename2 )
MyMail->AddInlineAttachment ( inlinefilename3 )
MyMail->AddAttachment ( filename1 )
MyMail->AddAttachment ( filename2 )
MyMail->AddAttachment ( filename3 )
MyMail->AddAttachment ( filename4 )
MyMail->SaveToFile ( ......eml );
delete MyMail;
Hans. |
|
| Back to top |
|
 |
Mark Jacobs Guest
|
Posted: Thu Feb 09, 2006 2:03 pm Post subject: Re: Bare LFs in SMTP |
|
|
Remy Lebeau (TeamB) wrote:
| Quote: | For the moment, use the following code:
void __fastcall TForm1::Button1Click(TObject *Sender)
{
SMTPMessage->Clear();
bool UsePlainText = (Memo1->GetTextLen() > 0);
bool UseHTML = (Memo2->GetTextLen() > 0);
int AttachmentCount = ListBox1->Items->Count;
if( AttachmentCount ) // no attachments
{
if( UsePlainText && !UseHTML )
{
SMTPMessage->Body->Text = Memo1->Text;
SMTPMessage->ContentType = "text/plain";
SMTPMessage->ContentTransferEncoding = "quoted-printable";
}
else if( !UsePlainText && UseHTML )
{
SMTPMessage->Body->Text = Memo2->Text;
SMTPMessage->ContentType = "text/html";
SMTPMessage->ContentTransferEncoding = "quoted-printable";
}
else
{
if( UsePlainText )
{
TIdText *NText = new TIdText(SMTPMessage->MessageParts,
Memo1->Lines);
NText->ContentType = "text/plain";
NText->ContentTransfer = "quoted-printable";
}
if( UseHTML )
{
TIdText *HText = new TIdText(SMTPMessage->MessageParts,
Memo2->Lines);
HText->ContentType = "text/html";
HText->ContentTransfer = "quoted-printable";
}
}
}
else
{
if( UsePlainText && !UseHTML )
{
// In order to provide a single text part with attachments,
you have to use the
// TIdMessage.Body property here. Do note, however, that
you do not have
// any control over the headers for the text part in this
scenerio!
SMTPMessage->Body = Memo1->Lines;
}
else if( !UsePlainText && UseHTML )
{
// Cannot use the TIdMessage.Body property in this scenerio
due to the
// lack of control over the headers for that text part, so
use a dummy
// plain-text part so that the html can be put into its own
text part.
TIdText *NText = new TIdText(SMTPMessage->MessageParts,
NULL);
NText->ContentType = "text/plain";
TIdText *HText = new TIdText(SMTPMessage->MessageParts,
Memo2->Lines);
HText->ContentType = "text/html";
HText->ContentTransfer = "quoted-printable";
}
else
{
if( UsePlainText )
{
TIdText *NText = new TIdText(SMTPMessage->MessageParts,
Memo1->Lines);
NText->ContentType = "text/plain";
NText->ContentTransfer = "quoted-printable";
}
if( UseHTML )
{
TIdText *HText = new TIdText(SMTPMessage->MessageParts,
Memo2->Lines);
HText->ContentType = "text/html";
HText->ContentTransfer = "quoted-printable";
}
}
// Attachments erstellen
for(int i = 0; i < AttachmentCount; ++i)
{
TIdAttachment *att = new
TIdAttachment(SMTPMessage->MessageParts, ListBox1->Items->Strings[i]);
att->ContentType = GetMIMETypeFromFile(att->FileName);
}
}
SMTPMessage->SaveToFile("c:\\test.eml");
}
In the meantime, I have made a small update TIdMessageClient to allow a
single TIdText to be used with attachments, with full header control. You
can download the newest snapshot within the next couple of days. Then the
above code can be simplified to the following:
void __fastcall TForm1::Button1Click(TObject *Sender)
{
TIdText *TextPart;
TIdAttachment *Att;
int AttachmentCount = ListBox1->Items->Count;
SMTPMessage->Clear();
if( Memo1->GetTextLen() > 0 )
{
if( (AttachmentCount == 0) && (!UseHTML) )
{
SMTPMessage->Body->Text = Memo1->Text;
SMTPMessage->ContentType = "text/plain";
SMTPMessage->ContentTransferEncoding = "quoted-printable";
}
else
{
TextPart = new TIdText(SMTPMessage->MessageParts,
Memo1->Lines);
TextPart->ContentType = "text/plain";
TextPart->ContentTransfer = "quoted-printable";
}
}
if( Memo2->GetTextLen() > 0 )
{
if( (AttachmentCount == 0) && (!UsePlainText) )
{
SMTPMessage->Body->Text = Memo2->Text;
SMTPMessage->ContentType = "text/html";
SMTPMessage->ContentTransferEncoding = "quoted-printable";
}
else
{
TextPart = new TIdText(SMTPMessage->MessageParts,
Memo2->Lines);
TextPart->ContentType = "text/html";
TextPart->ContentTransfer = "quoted-printable";
}
}
// Attachments erstellen
for(int i = 0; i < AttachmentCount; ++i)
{
Att = new TIdAttachment(SMTPMessage->MessageParts,
ListBox1->Items->Strings[i]);
Att->ContentType = GetMIMETypeFromFile(att->FileName);
}
SMTPMessage->SaveToFile("c:\\test.eml");
}
|
Remy, even the simplified code is overly complicated. An email component is supposed to
hold your hand, not bite it off! This is why I steer clear of Indy, and program at
ClientSocket level - my code is much cleaner.
--
Mark Jacobs
http://www.dkcomputing.co.uk |
|
| Back to top |
|
 |
Mark Jacobs Guest
|
Posted: Thu Feb 09, 2006 2:03 pm Post subject: Re: Problem with HTTP download locking up. |
|
|
Tom wrote:
| Quote: | I'll try the TIdLog and see if I can get the customer
to give it another go.
|
Any updates on how this worked out?
--
Mark Jacobs
http://www.dkcomputing.co.uk |
|
| Back to top |
|
 |
Mark Jacobs Guest
|
Posted: Thu Feb 09, 2006 3:03 pm Post subject: Re: Bare LFs in SMTP |
|
|
Hans Galema wrote:
| Quote: | How about this this ?
TMyMail *MyMail = new TMyMail;
MyMail->PlainText = ...; //TStrings or filename
MyMail->HtmlText = ...; //TStrings or filename
MyMail->AddInlineAttachment ( inlinefilename1 )
MyMail->AddInlineAttachment ( inlinefilename2 )
MyMail->AddInlineAttachment ( inlinefilename3 )
MyMail->AddAttachment ( filename1 )
MyMail->AddAttachment ( filename2 )
MyMail->AddAttachment ( filename3 )
MyMail->AddAttachment ( filename4 )
MyMail->SaveToFile ( ......eml );
delete MyMail;
|
Perfect! That's exactly the kind of component I could use! Where do I get one?
--
Mark Jacobs
http://www.dkcomputing.co.uk |
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Thu Feb 09, 2006 6:03 pm Post subject: Re: Bare LFs in SMTP |
|
|
"Mark Jacobs" <markj (AT) critical (DOT) co.uk> wrote in message
news:43eb24a7 (AT) newsgroups (DOT) borland.com...
| Quote: | Remy, even the simplified code is overly complicated.
|
What do you think is "overly complicated" about it exactly?
Gambit |
|
| Back to top |
|
 |
Mark Jacobs Guest
|
Posted: Fri Feb 10, 2006 11:03 am Post subject: Re: Bare LFs in SMTP |
|
|
Remy Lebeau (TeamB) wrote:
| Quote: | "Mark Jacobs" <markj (AT) critical (DOT) co.uk> wrote in message
news:43eb24a7 (AT) newsgroups (DOT) borland.com...
Remy, even the simplified code is overly complicated.
What do you think is "overly complicated" about it exactly?
|
Compare with Hans' component outline post above.
TMyMail *MyMail = new TMyMail;
MyMail->PlainText = ...; //TStrings or filename
MyMail->HtmlText = ...; //TStrings or filename
MyMail->AddInlineAttachment ( inlinefilename1 )
MyMail->AddInlineAttachment ( inlinefilename2 )
MyMail->AddInlineAttachment ( inlinefilename3 )
MyMail->AddAttachment ( filename1 )
MyMail->AddAttachment ( filename2 )
MyMail->AddAttachment ( filename3 )
MyMail->AddAttachment ( filename4 )
MyMail->SaveToFile ( ......eml );
delete MyMail;
It should be as easy as this if it's to be considered a useful aid to development.
--
Mark Jacobs
http://www.dkcomputing.co.uk |
|
| Back to top |
|
 |
Mr. Wuf Guest
|
Posted: Thu Feb 16, 2006 1:03 pm Post subject: Re: Bare LFs in SMTP |
|
|
| Quote: | You are probably using an old build, since that problem has already been
fixed a long time ago. |
Could it be that Indy has still problems with tabulators? The line length is
then exceeded. (Sometimes I get the error again...) |
|
| Back to top |
|
 |
Tom Guest
|
Posted: Wed Feb 22, 2006 2:03 am Post subject: Re: Problem with HTTP download locking up. |
|
|
I ended up giving the customer the alternative of being
able to manually download the files or continue to
work with me on the problem.
He chose to manually download the patch files rather
than to continue to try and figure out the problem.
It's one customer out of 1000+ so unless another
customer has the same problem and is willing to work
with me it will remain one of those unknowns...
-Tom
"Mark Jacobs" <markj (AT) critical (DOT) co.uk> wrote in message
news:43eb25e8 (AT) newsgroups (DOT) borland.com...
| Quote: | Tom wrote:
I'll try the TIdLog and see if I can get the customer
to give it another go.
Any updates on how this worked out?
--
Mark Jacobs
http://www.dkcomputing.co.uk |
|
|
| Back to top |
|
 |
Nigel Jones Guest
|
Posted: Thu Mar 30, 2006 4:03 pm Post subject: Re: Where can I download Indy 9.0.50? |
|
|
Hi,
I know this must be a basic question for those in the know. But what's the
difference between Indy 9 and Indy 10? Is 10 not recommended at this time?
Also what's the recommended version of 9 to run - note we're not allowed to
use the development snapshot, it must be an "official" release.
I downloaded the Indy 10 source (as I use BCB and that's what the site says
to do) but there aren't any BCB project files included.
Thanks for any help
Nigel Jones
"Remy Lebeau (TeamB)" <no.spam (AT) no (DOT) spam.com> wrote in message
news:43d81ca7$1 (AT) newsgroups (DOT) borland.com...
| Quote: |
"Paul" <plmacca (AT) clara (DOT) co.uk> wrote in message
news:43d7d41f$1 (AT) newsgroups (DOT) borland.com...
I must be missing something, because I can't find any web page
which refers to 9.0.50 in the indy project.
I told you earlier that 9.0.50 is the "Development Snapshot". There is a
link to it on the main download page.
- go to http://www.indyproject.org
- click on "Indy.Sockets"
- click on "Downloads"
- click on "Borland Native Compilers"
- click on "Indy 9"
- click on "Information" for the "Current Development Snapshot"
- click on "FTP" or "HTTP"
Gambit
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|