コード例 #1
0
 public Newsgroup ConnectGroup(string group)
 {
     if (this.connectedServer == null)
     {
         throw new NntpException("No connecting newsserver.");
     }
     if (this.connectedGroup == null || this.connectedGroup.Group != group)
     {
         Response res = MakeRequest("GROUP " + group);
         if (res.Code != 211)
         {
             this.connectedGroup = null;
             throw new NntpException(res.Code, res.Request);
         }
         string[] values = res.Message.Split(' ');
         this.connectedGroup = new Newsgroup(group, int.Parse(values[1]), int.Parse(values[2]));
     }
     return(this.connectedGroup);
 }
コード例 #2
0
 private void Reset()
 {
     this.connectedServer = null;
     this.connectedGroup  = null;
     this.username        = null;
     this.password        = null;
     if (this.tcpClient != null)
     {
         try
         {
             this.sw.Close();
             this.sr.Close();
             this.tcpClient.Close();
         }
         catch
         {
         }
     }
     this.tcpClient                = new TcpClient();
     this.tcpClient.SendTimeout    = timeout;
     this.tcpClient.ReceiveTimeout = timeout;
 }