Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow