qt8gt0bxhw|20009F4EEE83|RyanMain|subtext_Content|Text|0xfbffcb0000000000ba00000001000200
I just hate it when I come across something that should have been my idea!! ;-)
I found something really cool from Dirk Primbs - a managed provider for NNTP! What a cool idea. Dirk wraps all the NNTP protocol and socket work into objects that implement the interfaces from System.Data to give you a really cool way to read NNTP data. How about querying a newsgroup with a SQL select statement?! Here's a look at some code using Dirk's managed provider.
nntpConnection conn = new nntpConnection("news.microsoft.com");
try
{
conn.Open();
nntpCommand cmd = new nntpCommand("select top 10 * from microsoft.public.dotnet.languages.csharp", conn);
nntpDataAdapter da = new nntpDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
dataGrid1.DataSource = ds.Tables[0];
cmd.Dispose();
}
finally
{
conn.Dispose();
}
Now isn't that some familiar looking code? Very cool stuff. I used Dirk's managed provider and put together a rough RSS feed returning the latest posts from the Microsoft C# newsgroup. Took me all of about 5 minutes to do. Take a look and download the code below.
View the C# Newsgroup RSS feed Download the RSS feed source code
Now, keep in mind, the purpose of that feed is to just demonstrate how easy it was to read & use the NNTP data. If I really wanted to make a good RSS feed of that newsgroup it would make more sense to only use the initial/first post only and implement the rest as comments under that. Also, the feed above retrieves only the latest 20 posts (which is configurable as a param in the URI as you'll see in the source) and has a one hour cache on it so you won't see posts to the newsgroup until the cache is renewed or invalidated.
Have fun.