NNTP (usenet newsgroup) downloader for .NET
I would like to try to download usenet newsgroup messages. Anybody know how? I'd take a look at IPWorks but I don't understand how to download it. Any suggestio开发者_运维百科ns?
You can download a trial version of the /n software IP*Works toolkit for .NET at this URL: http://www.nsoftware.com/download/download.aspx?part=IPN8-A&prod=demo&type=exe
The IP*Works V8 .NET Edition even comes with an example NNTP Reader client in their included demos. Below is some sample code:
String body = "";
Nntp nntp1 = new Nntp();
nntp1.OnTransfer += new NntpOnTransferHandler(delegate(object sender, NntpTransferEventArgs e) {
body = e.Text;
});
nntp1.NewsServer = "some.server.com";
nntp1.User = "someuser";
nntp1.Password = "somepassword";
nntp1.Connect();
nntp1.CurrentGroup = "somegroup";
nntp1.CurrentArticle = "articlenumber";
nntp1.FetchArticle();
Console.WriteLine("Body: " + body);
This is a simple example, but the NNTPReader demo will give you a more complete example.
You pretty much just have to connect to it and then send NNTP commands and parse the results. Look at RFC3977 for information about NNTP.
If you search for "c# nntp" or similar in google you'll find plenty of samples.
This is assuming you only want to deal with text messages. If you want to deal with binaries it gets a bit more complicated and you probably have to look up yenc and similar.
精彩评论