Results 1 to 3 of 3
- 03-12-2011, 08:57 PM #1
Member
- Join Date
- Mar 2011
- Posts
- 2
- Rep Power
- 0
[NNTP] Unable to list newsgroups with commons.net module
Hi all,
This is my first post on this forum, so I hope I am doing this post correctly. If not let me know.
This weekend I have picked up my hobby in programming. AFter doing some in VBA/VB/C# and C back to my basics Java....
But now I am running against a wall. I was building a NNTP tool. For this I use the commons.net package form apache:
org.apache.commons.net.*
To do some testing with this I grabbed the test programs. Some of them are running fine, but at the moment I want to use the function list newsgroups it is going nuts:
Code where it is failing on is specificly:Java Code:LIST ACTIVE alt.fan.* 215 Newsgroups in form "group high low flags". org.apache.commons.net.MalformedServerReplyException: 000000000000000 000000000000000 y at org.apache.commons.net.nntp.NNTPClient.__readNewsgroupListing(NNTPClient.java:255) at org.apache.commons.net.nntp.NNTPClient.listNewsgroups(NNTPClient.java:949) at ExtendedNNTPOps.demo(ExtendedNNTPOps.java:70) at ExtendedNNTPOps.main(ExtendedNNTPOps.java:89) at Testing_NNTP.main(Testing_NNTP.java:21)
list = client.listNewsgroups();
May be someone knows this problem or knows what I am doing wrong. I have referenced the jar from apache in my project and logging in is no problem this is telling me that it should be working:
Any help on this is appreciated.Java Code:201 reader.xsnews.nl (frontend-F06-02) Server Ready - support@xsnews.nl AUTHINFO USER ****** 381 PASS required AUTHINFO PASS ******* 281 Ok Authentication succeeded GROUP alt.test 211 65330 4635 69964 alt.test XOVER 4635-4735 224 data follows
Ps. Aditional question, is it possible to make the connection over ssl?
Ps1:
Code exaple for listnewsgroups:
Java Code:/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ //package examples.nntp; import java.io.IOException; import org.apache.commons.net.nntp.NNTPClient; import org.apache.commons.net.nntp.NewsgroupInfo; /*** * This is a trivial example using the NNTP package to approximate the * Unix newsgroups command. It merely connects to the specified news * server and issues fetches the list of newsgroups stored by the server. * On servers that store a lot of newsgroups, this command can take a very * long time (listing upwards of 30,000 groups). * <p> ***/ public final class ListNewsgroups { public final static void main(String[] args) { NNTPClient client; NewsgroupInfo[] list; if (args.length < 1) { System.err.println("Usage: newsgroups newsserver"); System.exit(1); } client = new NNTPClient(); try { client.connect(args[0]); // AUTHINFO USER/AUTHINFO PASS boolean success = client.authenticate(args[1], args[2]); if (success) { System.out.println("Authentication succeeded"); } else { System.out.println("Authentication failed, error =" + client.getReplyString()); } list = client.listNewsgroups(); if (list != null) { for (int i = 0; i < list.length; i++) System.out.println(list[i].getNewsgroup()); } else { System.err.println("LIST command failed."); System.err.println("Server reply: " + client.getReplyString()); } } catch (IOException e) { e.printStackTrace(); } finally { try { if (client.isConnected()) client.disconnect(); } catch (IOException e) { System.err.println("Error disconnecting from server."); e.printStackTrace(); System.exit(1); } } } }Last edited by tudstudent; 03-12-2011 at 09:09 PM.
- 03-13-2011, 11:26 AM #2
Member
- Join Date
- Mar 2011
- Posts
- 2
- Rep Power
- 0
Small update. Got SSL to work, so this is fixed.
Only solution I am still looking for is why my newsgroups are not returned by Listnewsgroups.
- 04-18-2011, 10:08 AM #3
Member
- Join Date
- Apr 2011
- Posts
- 1
- Rep Power
- 0
Same here.
Java Code:LIST 215 Newsgroups in form "group high low flags". alt.binaries.boneless 4968906987 2256535552 y org.apache.commons.net.MalformedServerReplyException: alt.binaries.boneless 4968906987 2256535552 y at org.apache.commons.net.nntp.NNTPClient.__readNewsgroupListing(NNTPClient.java:255) at org.apache.commons.net.nntp.NNTPClient.listNewsgroups(NNTPClient.java:930) at com.scary.Nntp.main(Nntp.java:44)
Please let me know if you find a solution to this. That's be great!
Similar Threads
-
The module has not been deployed
By BrettCarr in forum NetBeansReplies: 0Last Post: 01-03-2011, 02:09 AM -
Netbeans Diff module
By momcilo_jocic@yahoo.com in forum NetBeansReplies: 0Last Post: 07-16-2010, 06:06 PM -
problem deploying war module
By aks_1 in forum Java ServletReplies: 4Last Post: 05-04-2010, 05:58 PM -
Commons validator
By aczuczor in forum Web FrameworksReplies: 0Last Post: 07-27-2007, 08:46 AM -
Netbeans platform - JDBC module
By sara in forum NetBeansReplies: 2Last Post: 07-10-2007, 01:21 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks