CSharpUtils.Net.FTP.DoUpload C# (CSharp) Метод

DoUpload() публичный Метод

Upload the file, to be used in a loop until file is completely uploaded
public DoUpload ( ) : long
Результат long
		public long DoUpload()
		{
			Byte[] bytes = new Byte[512];
			long bytes_got;

			try
			{
				bytes_got = file.Read(bytes, 0, bytes.Length);
				bytes_total += bytes_got;
				data_sock.Send(bytes, (int)bytes_got, 0);

				if (bytes_got <= 0)
				{
					// the upload is complete or an error occured
					file.Close();
					file = null;

					CloseDataSocket();
					ReadResponse();
					switch (response)
					{
						case 226:
						case 250:
							break;
						default:
							throw new Exception(responseStr);
					}

					SetBinaryMode(false);
				}
			}
			catch (Exception ex)
			{
				file.Close();
				file = null;
				CloseDataSocket();
				ReadResponse();
				SetBinaryMode(false);
				throw ex;
			}

			return bytes_got;
		}
		/// <summary>