How to get socket.SendStream progress?

I use the dephi7 client / server descriptor components to send a file with tfilestream from client to server.

I can get the progress of the file received on the server side, but on the client side, how can I get the progress of the sent file?

this is how i send the file:

  fstream:=tfilestream.Create(opendialog1.FileName,fmOpenRead);
  clientsocket1.Socket.SendStream(fstream);

Thanks and appreciate any help.

+3
source share
1 answer

It doesn't seem to TClientSocketprovide any feedback on its progress. I see two alternatives:

  • Instead SendStream, use TStream.Readand TClientSocket.Socket.SendBufto cycle. Read the data block from the stream and then send it. Repeat until you reach the end of the stream.

  • TStream , ( ) . Read, Write Seek , , , stream - SendStream , .

+5

Source: https://habr.com/ru/post/1745218/


All Articles