Hi
I would like to ask, why when i try to open file , that has been sent -
its empty. Size of sent file is proper, but for example when it's pdf -
acrobat reader says " file might be damaged"
Here is my send finction
try
{
if (Client.Connect ed)
{
this.Text = "Sending File";
String line = null;
file = new FileStream(sfNa me, FileMode.Open);
fileLength = file.Length;
Client.Client.S end(fName, 0, fName.Length,
SocketFlags.Non e);
int BytesCount = 0;
mylegth = fileLength / 100;
long i = 0;
this.smoothprog ressBar1.Value = 0;
byte[] buffer = new byte[64];
BytesCount = file.Read(buffe r, 0, 64);
while ((BytesCount != 0))
{
i += Client.Client.S end(buffer);
this.smoothprog ressBar1.Value = (int) ((i *
100)/ fileLength);
BytesCount = file.Read(buffe r,0,64);
}
file.Close();
Client.Close();
}
this.Dispose();
}
I would like to ask, why when i try to open file , that has been sent -
its empty. Size of sent file is proper, but for example when it's pdf -
acrobat reader says " file might be damaged"
Here is my send finction
try
{
if (Client.Connect ed)
{
this.Text = "Sending File";
String line = null;
file = new FileStream(sfNa me, FileMode.Open);
fileLength = file.Length;
Client.Client.S end(fName, 0, fName.Length,
SocketFlags.Non e);
int BytesCount = 0;
mylegth = fileLength / 100;
long i = 0;
this.smoothprog ressBar1.Value = 0;
byte[] buffer = new byte[64];
BytesCount = file.Read(buffe r, 0, 64);
while ((BytesCount != 0))
{
i += Client.Client.S end(buffer);
this.smoothprog ressBar1.Value = (int) ((i *
100)/ fileLength);
BytesCount = file.Read(buffe r,0,64);
}
file.Close();
Client.Close();
}
this.Dispose();
}
Comment