// We create nntp client object.
NntpClient nntp = new NntpClient();
try
{
// We connect to the nntp server.
nntp.Connect(_tbNntpServer.Text);
//Get the news group on the server
NewsGroupCollection groups = nntp.GetNewsGroups();
foreach (NewsGroup group in groups)
{
this.AddLogEntry(string.Format("Group name : {0}",group.Name));
}
}
catch (NntpException pexp)
{
this.AddLogEntry(string.Format("Nntp Error: {0}", pexp.Message));
}
catch (Exception ex)
{
this.AddLogEntry(string.Format("Failed: {0}", ex.Message));
}
finally
{
if (nntp.IsConnected)
{
nntp.Disconnect(); ;
}
}