Library tutorials & articles
How to NNTP in C#
- Introduction
- Connecting & Disconnecting
- Getting the Newsgroups
- Posting Messages
- Using the NNTP class
Connecting & Disconnecting
The first method of our Nntp client class is the Connect method. This method takes a server name that represents the remote NNTP server that will service our requests.
public void Connect(string server)
{
string response;
Connect(server, 119);
response = Response();
if (response.Substring(0, 3) != "200")
{
throw new NntpException(response);
}
}
We call the Connect method of our base TcpClient class with the server name and port 119. Port 119 is the well-known port for NNTP servers. The server should respond with a status-code indicating that connection was successful. When you are finished calling methods to the Nntp client object, then you should call the Disconnect method to terminate the connection.
public void Disconnect()
{
string message;
string response;
message = "QUIT\r\n";
Write(message);
response = Response();
if (response.Substring(0, 3) != "205")
{
throw new NntpException(response);
}
}
The method will send a QUIT message to the server and the server should respond with a 205 status-code indicating that the it is disconnecting the socket.
When you first instantiate the Nntp object you should call the Connect method and when you are finished you should call the Disconnect method. In between, you can call three method, GetNewsgroups, GetNews and Post, to receive and send news to the NNTP server.
Related articles
Related discussion
-
Buy Valtrex online no prescription. Valtrex with doctor consult. Buy Valtrex overnight cod. Valtrex discount.
by DrFed (12 replies)
-
Codeine on sale cheap online. Codeine fedex. Cheap online order Codeine. Where can I buy Codeine without a prescription.
by DrFed (14 replies)
-
Online pharmacy fedex C.O.D Adderall. Adderall buy in UK. How to get Adderall prescription. Adderall next day cod fedex.
by DrFed (14 replies)
-
Recommend where to buy Xenical online. Xenical online doctors. No rx Xenical. Xenical on line purchase.
by DrFed (17 replies)
-
Cheap online order Fioricet. Cheap discount Fioricet. Offshore Fioricet online. How to buy Fioricet online without a prescription.
by DrFed (23 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#.