Connecting NNTP server

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Connecting NNTP server

Halina Tam
Hi,
I am new to commons-net. I want to connect to a nntp server by using
NNTPClient.connect(), such as:
NNTPClient clinet = new NNTPClient();
client.connect("news://news.eclipse.org/");
client.authenticate("exquisitus", "flinder1f7");

But I always receive UnknownHostException:
java.net.UnknownHostException: news://news.eclipse.org/
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:153)
at java.net.Socket.connect(Socket.java:452)
at java.net.Socket.connect(Socket.java:402)
at java.net.Socket.<init>(Socket.java:309)
at java.net.Socket.<init>(Socket.java:124)
at org.apache.commons.net.DefaultSocketFactory.createSocket(DefaultSocketFactory.java:53)
at org.apache.commons.net.SocketClient.connect(SocketClient.java:162)
at org.apache.commons.net.SocketClient.connect(SocketClient.java:250)
at com.gsta.nntp.reader.NNTPReader.main(NNTPReader.java:29)

And there are three other ways to connect to a server, I dont know how
to use them.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Connecting NNTP server

Michael Katz
Try without the protocol:
...
client.connect("news.eclipse.org");
...

Halina Tam wrote:

> Hi,
> I am new to commons-net. I want to connect to a nntp server by using
> NNTPClient.connect(), such as:
> NNTPClient clinet = new NNTPClient();
> client.connect("news://news.eclipse.org/");
> client.authenticate("exquisitus", "flinder1f7");
>
> But I always receive UnknownHostException:
> java.net.UnknownHostException: news://news.eclipse.org/
> at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:153)
> at java.net.Socket.connect(Socket.java:452)
> at java.net.Socket.connect(Socket.java:402)
> at java.net.Socket.<init>(Socket.java:309)
> at java.net.Socket.<init>(Socket.java:124)
> at org.apache.commons.net.DefaultSocketFactory.createSocket(DefaultSocketFactory.java:53)
> at org.apache.commons.net.SocketClient.connect(SocketClient.java:162)
> at org.apache.commons.net.SocketClient.connect(SocketClient.java:250)
> at com.gsta.nntp.reader.NNTPReader.main(NNTPReader.java:29)
>
> And there are three other ways to connect to a server, I dont know how
> to use them.


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]