Library tutorials & articles
How to NNTP in C#
- Introduction
- Connecting & Disconnecting
- Getting the Newsgroups
- Posting Messages
- Using the NNTP class
Using the NNTP class
Using our NNTP class is quite trivial. An example follows.
static void Main(string[] args)
{
try
{
Nntp obj = new Nntp();
obj.Connect(" news.devx.com");
ArrayList list = obj.GetNewsgroups();
foreach (string newsgroup in list)
{
System.Console.WriteLine(" Newsgroup :{0}",
newsgroup);
}
list = obj.GetNews(" test");
foreach (string article in list)
{
System.Console.WriteLine("{0}", article);
}
obj.Post(" test", "Hello",
"randy@ kbcafe.com (Randy Charles Morin)", "Goodbye");
obj.Disconnect();
}
catch (NntpException e )
{
System.Console.WriteLine(e.ToString());
}
catch (System.Exception )
{
System.Console.WriteLine(" Unhandled Exception");
}
}
Instantiate an Nntp object and call Connect passing the NNTP server name. Then we can repeatedly call GetNewsgroups, GetNews and Post to receive and post articles in the forums found on the NNTP server. Finally you call the Disconnect method to release the socket connection to our NNTP server.
The RFC for NNTP is RFC 977 and can be found at the IETF website. You should also review the RFC for the USENET news message format as presented in RFC 850.
Related articles
Related discussion
-
C# video Editing/rendering
by pkuchaliya (0 replies)
-
How to Fill DataSet with more records (around 1 lakh) in a faster way
by Jayaram P (0 replies)
-
Can't print on the network with MSADESS ??
by anatha1 (2 replies)
-
Very Urgent regarding deleting the images from a folder
by Nanosteps (6 replies)
-
DataGridViewComboBoxColumn not showing values
by sachinkalse (0 replies)
Related podcasts
-
Object-Oriented Programming in Ruby
In this episode, I talk with Scott Bellware about object-oriented programming in Ruby, and Ruby's object model. This is taken from a private conversation, and the audio quality suffers at times. Much thanks to Scott for allowing this to be released.This episode of the Alt.NET Podcast is bro...
Great article - thanks.
However I'd like to post HTML to an NNTP server. I'm assuming that I need to specify this in the Header info somehow but can't find any documentation on NNTP message headers.
Could you shed some light here.
Thanks again
The only problem I found with this article, was the missing "Supporting Functions" you included in your other programs. Other than that, this is an awesome article! Keep up the good work!
This saved me days of work ! Thanks, really excellent.
This thread is for discussions of How to NNTP in C#.