Ik probeer dit weekend een simpel programma te maken waarmee ik alle nieuwsgroepen op mijn nieuwsserver kan bekijken. Helaas krijg ik dit niet voor elkaar.
Heb dit voor 2 verschillende server geprobeerd. Bij de tweede lukt het wel en bij de eerste lukt dit niet:
"reader.xsnews.nl" -> niet wekend
"freenews.netfront.net" -> werkend
Nu vraag ik mij af hoe dit komt en of dit te corrigeren is.
De functionaliteiten zitten in de package van apache:
- org.apache.commons.net.nntp
Ik heb de test example gebruikt voor mijn test:
Voordat ik nu verder ga zou ik graag dit probleem oplossen, maar ik kan niet zo goed vinden waar dit probleem zit. Het lijkt erop dat mijn nieuwsserver xsnews niet het commando verstaat. Of dit niet toestaat?
Heb dit voor 2 verschillende server geprobeerd. Bij de tweede lukt het wel en bij de eerste lukt dit niet:
"reader.xsnews.nl" -> niet wekend
"freenews.netfront.net" -> werkend
Nu vraag ik mij af hoe dit komt en of dit te corrigeren is.
De functionaliteiten zitten in de package van apache:
- org.apache.commons.net.nntp
Ik heb de test example gebruikt voor mijn test:
Java:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
| /* * 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]); 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); } } } } |
Voordat ik nu verder ga zou ik graag dit probleem oplossen, maar ik kan niet zo goed vinden waar dit probleem zit. Het lijkt erop dat mijn nieuwsserver xsnews niet het commando verstaat. Of dit niet toestaat?