BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

tcp server
Goto page 1, 2  Next
 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Internet Socket)
View previous topic :: View next topic  
Author Message
Jonathan Benedicto
Guest





PostPosted: Tue Feb 15, 2005 10:29 pm    Post subject: tcp server Reply with quote



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





PostPosted: Tue Feb 15, 2005 10:40 pm    Post subject: Re: tcp server Reply with quote



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





PostPosted: Tue Feb 15, 2005 10:42 pm    Post subject: Re: tcp server Reply with quote




"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





PostPosted: Sun Feb 05, 2006 12:27 am    Post subject: Re: Bare LFs in SMTP Reply with quote

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





PostPosted: Wed Feb 08, 2006 12:00 pm    Post subject: Re: URLEncode and Unicode Reply with quote

"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





PostPosted: Wed Feb 08, 2006 7:05 pm    Post subject: Re: URLEncode and Unicode Reply with quote

"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





PostPosted: Thu Feb 09, 2006 2:03 pm    Post subject: Re: Bare LFs in SMTP Reply with quote

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





PostPosted: Thu Feb 09, 2006 2:03 pm    Post subject: Re: Bare LFs in SMTP Reply with quote

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





PostPosted: Thu Feb 09, 2006 2:03 pm    Post subject: Re: Problem with HTTP download locking up. Reply with quote

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





PostPosted: Thu Feb 09, 2006 3:03 pm    Post subject: Re: Bare LFs in SMTP Reply with quote

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? Wink
--
Mark Jacobs
http://www.dkcomputing.co.uk
Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Thu Feb 09, 2006 6:03 pm    Post subject: Re: Bare LFs in SMTP Reply with quote

"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





PostPosted: Fri Feb 10, 2006 11:03 am    Post subject: Re: Bare LFs in SMTP Reply with quote

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





PostPosted: Thu Feb 16, 2006 1:03 pm    Post subject: Re: Bare LFs in SMTP Reply with quote

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





PostPosted: Wed Feb 22, 2006 2:03 am    Post subject: Re: Problem with HTTP download locking up. Reply with quote

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





PostPosted: Thu Mar 30, 2006 4:03 pm    Post subject: Re: Where can I download Indy 9.0.50? Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Internet Socket) All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.