RSS 2.0 Feed
RSS 2.0


Atom 1.0 Feed
Atom 1.0

  NNTP Managed Provider for ADO.NET 


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.




                   



Leave a comment below.

Comments

  1. Dirks WebLog 5/23/2004 5:04 AM
    Gravatar
  2. Dirks WebLog 5/23/2004 5:04 AM
    Gravatar
  3. Wallace B. McClure 5/27/2004 10:04 PM
    Gravatar
  4. Blog de JuanCri 5/31/2004 4:23 PM
    Gravatar
  5. No Fun Intended 3/1/2005 5:08 AM
    Gravatar
Comments have been closed on this topic.



 

News


Also see my CRM Developer blog

Connect:   @ryanfarley@mastodon.social

         

Sponsor

Sections