delphi发送stream出现Stream read error
使用delphi截屏存为stream,然后使用idudp发送,部分代码如下
jpgimage .SaveToStream(jpgstream ) ;
leftsize :=jpgstream .Size ;
if leftsize >buffsize then
sendsize :=buffsize
else
sendsize :=buffsize ;
idpclnt1 .Host :='127.0.0.1';
idpclnt1 .Port :=9999;
jpgstream .ReadBuffer(buf ,sendsize );
leftsize :=leftsize - sendsize ;
idpclnt1 .SendBuffer(buf ,sendsize );
当运行到红色那一行时就出错
project PRTSC.exe raised exception class EReadError with message 'Stream read error'.Process stopped .Use Step or Run to continue.
然后跳到工程文件下的end那行
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.
这是为什么?怎么改?或者谁有一个发送图片的客户端、服务端的完整文件的例子帮忙发一份谢谢了