HowTo 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://news.microsoft.com]. More often than not, you can launch your NetNews client by typing the nntp URL in your browser’s address bar.
…
The method will send a QUIT message to the server and the server should respond with a 205 status-code indicating that the it is disconnecting the socket. When you first instantiate the Nntp object you should call the Connect method and when you are finished you should call the Disconnect method. In between, you can call three method, GetNewsgroups, GetNews and Post, to receive and send news to the NNTP server. The GetNewsgroups method, receives from the NNTP server all the forums that are supported by the server.
…
The GetNewsgroups method begins by sending a LIST message to the NNTP server. The NNTP server will respond initially with the 215 status-code indicating that it successfully received the LIST message. Then the NNTP server will respond with a series of lines, each representing one forum on the NNTP server. After all the forums are sent, the NNTP server will send one line with a single period, indicating the end of the forum list. The list of forums is returned from the GetNewsgroups method as an ArrayList of strings. From the list of forums, you can select one forum and receive from the GetNews method all the news for that forum. Call GetNews passing the name of the forum to receive the news postings.
…
Website: www.kbcafe.com | Filesize: 103kb
No of Page(s): 6
Click here to download HowTo NNTP in C#.
Related Tutorial
Tags: .NET, networking, NNTP
Comments
Leave a Reply