TFTPTransferState.cs
Upload User: hhy9292
Upload Date: 2014-10-04
Package Size: 37k
Code Size: 3k
Category:

Ftp Client

Development Platform:

Visual C++

  1. using System;
  2. using System.Text;
  3. namespace TFTPUtil
  4. {
  5.     /// <summary>
  6.     /// This class keeps state information about on going TFTP transfer for use in a user interface
  7.     /// </summary>
  8.     public class TFTPTransferState
  9.     {
  10.         public readonly Guid ident = Guid.NewGuid();
  11.         private int Opcode;
  12.         /// <summary>
  13.         /// A long specifying the length of the file
  14.         /// </summary>
  15.         public long FileLength = 0;
  16.         /// <summary>
  17.         /// A long specifying the current number of bytes transfered
  18.         /// </summary>
  19.         public long BytesTransfered = 0;
  20.         /// <summary>
  21.         /// If the TFTP transfer is currently open
  22.         /// </summary>
  23.         public bool Opened = true;
  24.         /// <summary>
  25.         /// If the TFTP transfer is currently closed
  26.         /// </summary>
  27.         public bool Closed = false;
  28.         private string RemoteAddress;
  29.         private int Port;
  30.         private string FileName;
  31.         public bool ErrorOccurred = false;
  32.         public string ErrorMsg = "";
  33.         /// <summary>
  34.         /// Creates a new instance of the TFTPTransferState
  35.         /// </summary>
  36.         /// <param name="Opcode">The original TFTP Opcode received from the remote</param>
  37.         /// <param name="RemoteIPAddress">The Remote IP Address initiating the transfer</param>
  38.         /// <param name="Port">The remote UDP port</param>
  39.         /// <param name="FileName">The file name the remote client connected</param>
  40.         public TFTPTransferState(int Opcode, string RemoteIPAddress, int Port, string FileName)
  41.         {
  42.             this.Opcode = Opcode;
  43.             RemoteAddress = RemoteIPAddress;
  44.             this.Port = Port;
  45.             this.FileName = FileName;
  46.         }
  47.         /// <summary>
  48.         /// Returns the original TFTP message type received from the remote
  49.         /// </summary>
  50.         public int TransferType
  51.         {
  52.             get
  53.             {
  54.                 return Opcode;
  55.             }
  56.         }
  57.         /// <summary>
  58.         /// Gets the Remote IP Address
  59.         /// </summary>
  60.         public string RemoteIPAddress
  61.         {
  62.             get
  63.             {
  64.                 return RemoteAddress;
  65.             }
  66.         }
  67.         /// <summary>
  68.         /// Gets the remote UDP port
  69.         /// </summary>
  70.         public int RemotePort
  71.         {
  72.             get
  73.             {
  74.                 return Port;
  75.             }
  76.         }
  77.         /// <summary>
  78.         /// Gets the filename the remore client specified
  79.         /// </summary>
  80.         public string Filename
  81.         {
  82.             get
  83.             {
  84.                 return FileName;
  85.             }
  86.         }
  87.     }
  88. }