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>