Click here to Skip to main content
11,578,524 members (60,615 online)
Click here to Skip to main content

NNTP library that supports post retrieval with attachments and a lot more

, 24 Mar 2004 92.7K 398 42
Rate this:
Please Sign up or sign in to vote.
NNTP library for .NET

Introduction

I have built this library because I found that there is lack of support for NNTP. I wanted a library supporting Multilanguage posts with attachments. That required MIME handling, Base64, UUEncode, Quoted-Printable etc. I also wanted a library with Authentication support too.

Using the code

Classes can be classified as below.

  • BS: NntpConnection
  • VO: Article, ArticleBody, ArticleHeader, Attachment, MIMEPart, Newsgroup
  • Util: NntpUtil
  • Exp: NntpException

Using the library is simple, and it is done mainly by manipulating the NntpConnection class.

Connect to a specified news server and list all the newsgroups:

NntpConnection con = new NntpConnection();
con.ConnectServer(serverName, 119);
ArrayList list = con.GetGroupList();
foreach ( Newsgroup ng in list )
    Console.WriteLine(ng.Group);

Subscribe to a group and list out all the articles:

Newsgroup ng = con.ConnectGroup(groupName);
ArrayList list = con.GetArticleList(ng.Low, ng.High);
foreach( Article article in list )
    Console.WriteLine(article.Header.Subject);

Retrieve an article, examine the text content and save the attachment:

// msgId can be a string or an integer
Article a = con.GetArticle(msgId);
Console.WriteLine(a.Body.Text);
foreach ( Attachment at in a.Body.Attachments )
{
    at.SaveAs(@"C:\Temp\" + at.Filename, true);
}

If you want to provide an identity:

NntpConnection con = new NntpConnection();
con.ConnectServer(serverName, 119);
// Identity will be store and will be sent automatically upon the server request
con.ProvideIdentity(username, password);
// You can force the identity to be sent immediately, 
// however some servers do not support this
con.SendIdentity();

This is a brief description only and my library has many more features. I will review this article if I have time.

More Information

Articles are decoded by self-built library, where it is still far away from the internet standard. However, it should be able to decode over 95% of the posts in the internet. These codes are still under development and will be updated soon.

History

  • Beta 0.1 2004/03/17
  • Beta 0.2 2004/03/23
    • Enhanced MIME support by optimizing internal implementation.
    • Restructured some classes.
    • New authentication methods.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

HKcow
Hong Kong Hong Kong
No Biography provided

You may also be interested in...

Comments and Discussions

 
Questionany updates? like yEnc for example? Pin
ringdrossel12-Sep-09 4:49
memberringdrossel12-Sep-09 4:49 
QuestionDateTimeFormat errors (It doesn't like the DateTime Object) Pin
undeclared9-Jul-07 0:50
memberundeclared9-Jul-07 0:50 
AnswerRe: DateTimeFormat errors (It doesn't like the DateTime Object) Pin
undeclared9-Jul-07 1:36
memberundeclared9-Jul-07 1:36 
Generalmultiple part attatchements Pin
ThisBytes517-Mar-07 8:57
memberThisBytes517-Mar-07 8:57 
QuestionPost message Pin
The Will3-Aug-06 15:59
memberThe Will3-Aug-06 15:59 
AnswerRe: Post message Pin
eric.nadeau5-Jan-07 8:43
membereric.nadeau5-Jan-07 8:43 
GeneralRe: Post message Pin
eric.nadeau9-Jan-07 3:44
membereric.nadeau9-Jan-07 3:44 
GeneralRe: Post message [modified] Pin
eric.nadeau4-Apr-07 4:22
membereric.nadeau4-Apr-07 4:22 
GeneralGood Job~ Pin
VB.NET / ASP.NET Beginner8-Jan-06 8:47
memberVB.NET / ASP.NET Beginner8-Jan-06 8:47 
QuestionArrange Headers ? Pin
nihonsx58-Dec-05 16:56
membernihonsx58-Dec-05 16:56 
GeneralImage Attachments Pin
Dude9021010-Aug-05 14:12
sussDude9021010-Aug-05 14:12 
GeneralRe: Image Attachments Pin
Duder9021010-Aug-05 15:07
sussDuder9021010-Aug-05 15:07 
QuestionConfused about onRequest Pin
Kluch5-Aug-05 12:18
memberKluch5-Aug-05 12:18 
GeneralExcellent Job! just one comment :) Pin
Steven Burns28-Aug-04 8:58
memberSteven Burns28-Aug-04 8:58 
Generalgood job Pin
bouli11-May-04 4:23
memberbouli11-May-04 4:23 
GeneralRe: good job Pin
asabit26-Dec-04 4:23
memberasabit26-Dec-04 4:23 
GeneralSample Project Pin
mdande21-Apr-04 19:43
membermdande21-Apr-04 19:43 
QuestionAm I missing Something? Pin
Russell Mangel27-Mar-04 1:34
memberRussell Mangel27-Mar-04 1:34 
AnswerRe: Am I missing Something? Pin
HKcow27-Mar-04 3:48
memberHKcow27-Mar-04 3:48 
AnswerRe: Am I missing Something? Pin
bouli11-May-04 4:02
memberbouli11-May-04 4:02 
GeneralWell Done Pin
JaseNet26-Mar-04 18:13
sussJaseNet26-Mar-04 18:13 
GeneralRe: Well Done Pin
JaseNet26-Mar-04 19:22
memberJaseNet26-Mar-04 19:22 
GeneralRe: Well Done Pin
HKcow26-Mar-04 20:07
memberHKcow26-Mar-04 20:07 
GeneralKnown Issue Pin
HKcow26-Mar-04 13:58
memberHKcow26-Mar-04 13:58 
QuestionConsidered OO design? Pin
zucchini23-Mar-04 10:58
memberzucchini23-Mar-04 10:58 
AnswerRe: Considered OO design? Pin
HKcow23-Mar-04 14:20
memberHKcow23-Mar-04 14:20 
QuestionAuthentication? Pin
Ryan Farley22-Mar-04 4:30
memberRyan Farley22-Mar-04 4:30 
AnswerRe: Authentication? Pin
HKcow22-Mar-04 14:37
memberHKcow22-Mar-04 14:37 
QuestionYenc? Pin
Carl Mercier22-Mar-04 4:10
memberCarl Mercier22-Mar-04 4:10 
AnswerRe: Yenc? Pin
HKcow22-Mar-04 14:34
memberHKcow22-Mar-04 14:34 
GeneralRe: Yenc? Pin
casperOne25-Mar-04 2:26
membercasperOne25-Mar-04 2:26 
GeneralRe: Yenc? Pin
Anonymous25-Mar-04 14:07
sussAnonymous25-Mar-04 14:07 
GeneralRe: Yenc? Pin
HKcow25-Mar-04 14:13
memberHKcow25-Mar-04 14:13 
GeneralRe: Yenc? Pin
casperOne25-Mar-04 16:32
membercasperOne25-Mar-04 16:32 
GeneralRe: Yenc? Pin
HKcow25-Mar-04 21:33
memberHKcow25-Mar-04 21:33 
GeneralRe: Yenc? Pin
Carl Mercier25-Mar-04 4:17
memberCarl Mercier25-Mar-04 4:17 
GeneralRe: Yenc? Pin
Carl Mercier25-Mar-04 4:20
memberCarl Mercier25-Mar-04 4:20 
GeneralRe: Yenc? Pin
HKcow25-Mar-04 14:11
memberHKcow25-Mar-04 14:11 
GeneralRe: Yenc? Pin
Carl Mercier25-Mar-04 14:53
memberCarl Mercier25-Mar-04 14:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150603.1 | Last Updated 25 Mar 2004
Article Copyright 2004 by HKcow
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid