Article View: borland.public.cppbuilder.internet.socket
Article #1220Re: Indys NNTP Posting problem
From: Remy Lebeau (TeamB)
Date: Mon, 05 Mar 2007 18:19
Date: Mon, 05 Mar 2007 18:19
59 lines
2540 bytes
2540 bytes
"MwnN" <MwnN@localhost.com> wrote in message
news:1NOdncmTj_xWj3HYRVnygAA@giganews.com...
> I was wondering what might be wrong with the below code, it
> runs fine but there's no message being posted onto the server
Is there an exception being thrown? If not, then the message is
guaranteed to be posted.
> is there a was I can get information back from the Post() method to
> inform me if it was successful or failed?
If no exception is thrown, then it was successful.
> the OnStatus even tells me "Encoding Text" and then that's it, my
thread exits.
Then an exception is likely being thrown that you are not catching.
You should be wrapping your code in try..catch blocks, ie:
IdNNTP2->Username = "********";
IdNNTP2->Password = "********";
IdNNTP2->Host = "my-news-server.com";
IdNNTP2->Port = 119;
try
{
TIdMessage* msg = new TIdMessage(NULL);
try
{
msg->ReplyTo->EMailAddresses = "Test@test.co.uk";
msg->From->Address = "Test@test.co.uk";
msg->Body->Text = "Testing Text Post";
msg->Subject = "Testing Text Post";
IdNNTP2->Connect();
try
{
IdNNTP2->SelectGroup("0.test");
IdNNTP2->Post(msg);
}
__finally
{
IdNNTP2->Disconnect();
}
}
__finally
{
delete msg;
}
}
catch(const Exception &)
{
// error posting the message, do something
}
Gambit
Technical Details
Message-ID:
<45ec673b@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wns14feed!worldnet.att.net!64.192.187.27!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<1NOdncmTj_xWj3HYRVnygAA@giganews.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,8d4a352b876ea3ce X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> Newsgroups: borland.public.cppbuilder.internet.socket References: <1NOdncmTj_xWj3HYRVnygAA@giganews.com> Subject: Re: Indys NNTP Posting problem Date: Mon, 5 Mar 2007 10:19:00 -0800 Lines: 61 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 75.83.34.171 Message-ID: <45ec673b@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1173120827 75.83.34.171 (5 Mar 2007 10:53:47 -0800) Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wns14feed!worldnet.att.net!64.192.187.27!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail