M
METALLEE
Unregistered / Unconfirmed
GUEST, unregistred user!
我在memorystream里保存了一段文件流,在memorystream的前13个字节里我希望插入13个字符以做标志,通过NMUDP传输 NMUDP收到字节后报错stream read error
写入流的代码是:
var
TempStream:TMemoryStream;
FileStream:TFileStream;
SendMsg:string;
`````
````
SendMsg:='...';(十三个字符)
TempStream.Write(SendMsg[1],13);
TempStream.CopyFrom(FileStream,2048);
try
FUDP.SendStream(TempStream);
finally
end;
接收代码:
TempStream := TMemoryStream.Create;
try
FUDP.ReadStream(TempStream);
finally
end;
运行到FUDP.ReadStream(TempStream);时报错stream read error
高手告诉我这个问题如何解决?
写入流的代码是:
var
TempStream:TMemoryStream;
FileStream:TFileStream;
SendMsg:string;
`````
````
SendMsg:='...';(十三个字符)
TempStream.Write(SendMsg[1],13);
TempStream.CopyFrom(FileStream,2048);
try
FUDP.SendStream(TempStream);
finally
end;
接收代码:
TempStream := TMemoryStream.Create;
try
FUDP.ReadStream(TempStream);
finally
end;
运行到FUDP.ReadStream(TempStream);时报错stream read error
高手告诉我这个问题如何解决?