Raj

Raj

  • NA
  • 2
  • 0

C# receiving file from Socket

Dec 7 2006 8:54 AM

Hi,

1)

I am performing one Client socket operation to send and receive data from FTP server.

I have set an buffer size to 15 Kb to send and receive data.

While sending data it sends 15 Kb properly and thers no problem.

But while performing receive operation i have used the following method :

 

SecureSocket ClientDataSocket;

do
{

 int Result = ClientDataSocket.Receive(Data,Buffer,0);
 
 //Write Result to file;

}while(Result>0);

when the above method is get evaluated in the do-while loop.

Since Buffer limit is 15 kb ,First time Result gets value around 13Kb but next time in loop it gets 4 Kb.
 and this alternate feature continues till the whole file is received.


Due to this my File receive operation take more time then expeted ..


Please help me how can i get the constant 15 kb while receiving from server.

 


2)
By how much KB can i increase the buffer size for optimal result for send and receive to be faster.

 


Waiting for reply..

Regards