|
using System;
using System.Collections.Generic;
using System.Text;
using System.Net.Sockets;
using System.IO;
namespace Net.Mail
{
/// <summary>
/// This class represents the Pop3 RETR command.
/// </summary>
internal sealed class RetrCommand : Pop3Command<RetrResponse>
{
int _message;
/// <summary>
/// Initializes a new instance of the <see cref="RetrCommand"/> class.
/// </summary>
/// <param name="stream">The stream.</param>
/// <param name="message">The message.</param>
public RetrCommand(Stream stream, int message)
: base(stream, true, Pop3State.Transaction)
{
if (message < 0)
{
throw new ArgumentOutOfRangeException("message");
}
_message = message;
}
/// <summary>
/// Creates the RETR request message.
/// </summary>
/// <returns>
/// The byte[] containing the RETR request message.
/// </returns>
protected override byte[] CreateRequestMessage()
{
return GetRequestMessage(Pop3Commands.Retr, _message.ToString(), Pop3Commands.Crlf);
}
/// <summary>
/// Creates the response.
/// </summary>
/// <param name="buffer">The buffer.</param>
/// <returns>
/// The <c>Pop3Response</c> containing the results of the
/// Pop3 command execution.
/// </returns>
protected override RetrResponse CreateResponse(byte[] buffer)
{
Pop3Response response = Pop3Response.CreateResponse(buffer);
string[] messageLines = GetResponseLines(StripPop3HostMessage(buffer, response.HostMessage));
return new RetrResponse(response, messageLines);
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.