You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Rakesh Shukla <ry...@hotmail.com> on 2006/02/07 03:11:25 UTC
[Net] NNTPClient: How to use retrieveArticle and retrieveArticleBody methods?
Hi,
I am able to post an article using following (example) code.
Writer writer = client.postArticle();
if (writer != null) {
SimpleNNTPHeader header=new SimpleNNTPHeader
("foobar@foo.com","Just testing");
Header.addNewsgroup("alt.test");
writer.write(header.toString());
writer.write("This is just a test");
writer.close();
client.completePendingCommand();
}
When I use any of the retrieveArticle and retrieveArticleBody methods the
system just hangs. Please let me know how to use these methods properly.
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: [Net] NNTPClient: How to use retrieveArticle and retrieveArticleBody
methods?
Posted by Rory Winston <rw...@eircom.net>.
Rakesh
Try attaching a ProtocolCommandListener to the in/out streams so you can
debug what is happening on the wire:
client = new NNTPClient();
client.addProtocolCommandListener(new PrintCommandListener(new PrintWriter(System.out)));
I also dont think you need to call completePendingCommand() ( I may be mistaken here, its been a while since I had a look at this).
Make sure you have called selectNewsgroup() as well.
Cheers
Rory
Rakesh Shukla wrote:
> Hi,
>
> I am able to post an article using following (example) code.
>
> Writer writer = client.postArticle();
> if (writer != null) {
> SimpleNNTPHeader header=new SimpleNNTPHeader
> ("foobar@foo.com","Just testing");
> Header.addNewsgroup("alt.test");
> writer.write(header.toString());
> writer.write("This is just a test");
> writer.close();
> client.completePendingCommand();
> }
>
> When I use any of the retrieveArticle and retrieveArticleBody methods
> the system just hangs. Please let me know how to use these methods
> properly.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org