Mega Code Archive

 
Categories / Delphi / LAN Web TCP
 

About the sendstream of TNMUDP component

Title: about the sendstream of TNMUDP component Question: I want to send a bitmap from one PC to another PC in the same workgroup. procedure TForm1.CUDPDataReceived(Sender: TComponent; NumberBytes: Integer; FromIP: String; Port: Integer); var Rcode : char; begin sendstream := Tmemorystream.Create; cudp.ReadBuffer(RCode,NumberBytes); if RCode = 'k' then begin sendstream.LoadFromFile('c:\mybmp.bmp); try CUDP.RemoteHost := FromIP; CUDP.SendStream(sendstream); finally sendstream.Free; end; end; end; when the project run to CUDP.SendStream(sendstream),it raise the exception,and i change the send-file,sendstream.loadfromfile('c:\my.txt') instead of ('c:\mybmp.bmp'),the project runs ok. i can't tell why it can happen and solve the problem. Answer: I want to send a bitmap from one PC to another PC in the same workgroup. procedure TForm1.CUDPDataReceived(Sender: TComponent; NumberBytes: Integer; FromIP: String; Port: Integer); var Rcode : char; begin sendstream := Tmemorystream.Create; cudp.ReadBuffer(RCode,NumberBytes); if RCode = 'k' then begin sendstream.LoadFromFile('c:\mybmp.bmp); try CUDP.RemoteHost := FromIP; CUDP.SendStream(sendstream); finally sendstream.Free; end; end; end; when the project run to CUDP.SendStream(sendstream),it raise the exception,and i change the send-file,sendstream.loadfromfile('c:\my.txt') instead of ('c:\mybmp.bmp'),the project runs ok. i can't tell why it can happen and solve the problem.