views:

119

answers:

1

Hay Guys, i want to write a simple NNTP client, which can connect to a server, send AUTHINFO details, and use GROUP and BODY to join a group and retreive posts.

I had a discussion with a couple of guys in here and they suggested using dataGramSockets and datGramPackets.

Could anyone provide a simple script to do these explaining how each command works and why use DataGram Sockets over the tradtional Socket? I used Socket and was able to connect to my server, but i hadn't a clue how to use getInputStream() and getOutputStream() to send/receive data to the server.

Any help would be great.

+1  A: 

Isn't NNTP a TCP-based protocol ? I don't think datagrams would be appropriate here. See the RFC for further info re. using this protocol.

I see that Apache Commons Net offer an NNTP package, which may be of use.

NNTPClient encapsulates all the functionality necessary to post and retrieve articles from an NNTP server. As with all classes derived from SocketClient, you must first connect to the server with connect before doing anything, and finally disconnect() after you're completely finished interacting with the server. Remember that the isAllowedToPost() method is defined in NNTP.

I'd avoid using raw sockets if someone has already done this hard work.

Brian Agnew
Brilliant. Thanks for the link.
dotty
How would i include this package in a android application?
dotty
Sorry. I'm not au fait with Android, so I can't really advise on that specifically.
Brian Agnew
Managed to import it, but when i run nntp.connect(). It crashes the app.
dotty