How to NNTP in C#


This is the third in a series of articles on Internet programming with Microsoft's new C# programming language. In the first two articles, I wrote two simple TCP/ IP classes for SMTP and POP3 clients. In this article, I'm going to write a simple NNTP class.

NNTP is an older fading protocol in the Internet protocol family. The protocol is used to retrieve news from news server, a.k.a. NetNews servers. The protocol works by posting messages into various forums, a.k.a. newsgroups. Then other end-users can read the recent posts in the forums. There also exist protocols for distributing NetNews contents amongst various NetNews servers, allowing thousands of servers to share news and forums. The most popular news server is of course Microsoft's [nntp://]. More often than not, you can launch your NetNews client by typing the nntp URL in your browser's address bar.

public class NntpException : System.ApplicationException
    public NntpException(string str)

I'm still unsure how best to implement exception classes in .NET and as such I've remained faithful to my C++ roots. I'm investigating otherwise and might consider writing a brief article on just this subject. We'll see. Next step is the class declaration. I'm deriving the Nntp class from the TcpClient class in the System.Net.Sockets namespace of the .NET framework.

public class Nntp : System.Net.Sockets.TcpClient

We'll inherit a lot of basic functionality from the TcpClient class.

You might also like...


About the author

Randy Charles Morin

Randy Charles Morin Canada

Randy's article are Copyright 1998-2003 Randy Charles Morin

Interested in writing for us? Find out more.


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“A computer lets you make more mistakes faster than any other invention in human history, with the possible exceptions of handguns and tequila” - Mitch Ratcliffe