Beispiel #1
0
        private string SendCommand(PopCommand command)
        {
            baseStream.Seek(0, SeekOrigin.Begin);

              sender.Send(command);

              baseStream.Seek(0, SeekOrigin.Begin);

              var reader = new StreamReader(baseStream, NetworkTransferEncoding.Transfer8Bit);

              return reader.ReadToEnd();
        }
Beispiel #2
0
        public void Send(PopCommand command)
        {
            var sb = new StringBuilder();

              if (command.Command != null)
            sb.Append(command.Command);

              foreach (var param in command.Parameters) {
            if (0 < sb.Length)
              sb.Append(Chars.SP);
            sb.Append(param);
              }

              sb.Append(Chars.CRLF);

              Send(NetworkTransferEncoding.Transfer7Bit.GetBytes(sb.ToString()));
        }
Beispiel #3
0
        public void SendCommand(PopCommand command)
        {
            CheckConnected();

              try {
            (Sender as PopCommandSender).Send(command);

            lastSentTime = DateTime.Now;
              }
              catch (SocketException ex) {
            throw CreateSocketErrorException(ex, false);
              }
              catch (IOException ex) {
            var socketException = ex.InnerException as SocketException;

            if (socketException == null)
              // unexpected IO error
              throw;
            else
              throw CreateSocketErrorException(socketException, false);
              }
        }