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://news.microsoft.com]. 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