使用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.
这是为什么?怎么改?或者谁有一个发送图片的客户端、服务端的完整文件的例子帮忙发一份谢谢了
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.
这是为什么?怎么改?或者谁有一个发送图片的客户端、服务端的完整文件的例子帮忙发一份谢谢了
确实写错了,delphi学了两个月,参考书很少涉及网络组件的,对网络组件就边百度边学,纠结死这个问题了。只是复制了一部分代码,后面还有循环部分的就是在接收的部分if receivesize > buffsize 发送一个send,让发送端继续发送
jpgstream.Position:=0;