www.pudn.com > TFTPUtil_Source_Version_1.3.0.zip > TFTPTransferState.cs
using System;
using System.Text;
namespace TFTPUtil
{
///
/// This class keeps state information about on going TFTP transfer for use in a user interface
///
public class TFTPTransferState
{
public readonly Guid ident = Guid.NewGuid();
private int Opcode;
///
/// A long specifying the length of the file
///
public long FileLength = 0;
///
/// A long specifying the current number of bytes transfered
///
public long BytesTransfered = 0;
///
/// If the TFTP transfer is currently open
///
public bool Opened = true;
///
/// If the TFTP transfer is currently closed
///
public bool Closed = false;
private string RemoteAddress;
private int Port;
private string FileName;
public bool ErrorOccurred = false;
public string ErrorMsg = "";
///
/// Creates a new instance of the TFTPTransferState
///
/// The original TFTP Opcode received from the remote
/// The Remote IP Address initiating the transfer
/// The remote UDP port
/// The file name the remote client connected
public TFTPTransferState(int Opcode, string RemoteIPAddress, int Port, string FileName)
{
this.Opcode = Opcode;
RemoteAddress = RemoteIPAddress;
this.Port = Port;
this.FileName = FileName;
}
///
/// Returns the original TFTP message type received from the remote
///
public int TransferType
{
get
{
return Opcode;
}
}
///
/// Gets the Remote IP Address
///
public string RemoteIPAddress
{
get
{
return RemoteAddress;
}
}
///
/// Gets the remote UDP port
///
public int RemotePort
{
get
{
return Port;
}
}
///
/// Gets the filename the remore client specified
///
public string Filename
{
get
{
return FileName;
}
}
}
}