小
小飞龙
Unregistered / Unconfirmed
GUEST, unregistred user!
while not Sender.Terminated do
begin
if frm_Client.LDPClient.Connected then
try
Leng := frm_Client.LDPClient.ReadFromStack();
if Leng > 0 then
begin
frm_Client.LDPClient.ReadBuffer(Msg, SizeOf(MsgHeader));
case Msg.MsgType of
iRestart:
begin
frm_Client.LDPClient.Disconnect;
.......
end;
iUrgentFile:
begin
if frm_Client.LDPClient.ReadFromStack() > 0 then
frm_Client.LDPClient.ReadBuffer(MsgPlaylist, SizeOf(MsgPlayList));
....
end;
......
我这样做对不对
Server端发过来的包包含包头,还有body两部分,我在线程中先读去包头,判断什么包然后在按照body的类型来读,不管用不用if frm_Client.LDPClient.ReadFromStack() > 0 then
好像读出来都有问题,有时候读到的包的数据跟发的不一样,如果我一次性读就没有问题,难道不能分2次来读发过来的包吗?
begin
if frm_Client.LDPClient.Connected then
try
Leng := frm_Client.LDPClient.ReadFromStack();
if Leng > 0 then
begin
frm_Client.LDPClient.ReadBuffer(Msg, SizeOf(MsgHeader));
case Msg.MsgType of
iRestart:
begin
frm_Client.LDPClient.Disconnect;
.......
end;
iUrgentFile:
begin
if frm_Client.LDPClient.ReadFromStack() > 0 then
frm_Client.LDPClient.ReadBuffer(MsgPlaylist, SizeOf(MsgPlayList));
....
end;
......
我这样做对不对
Server端发过来的包包含包头,还有body两部分,我在线程中先读去包头,判断什么包然后在按照body的类型来读,不管用不用if frm_Client.LDPClient.ReadFromStack() > 0 then
好像读出来都有问题,有时候读到的包的数据跟发的不一样,如果我一次性读就没有问题,难道不能分2次来读发过来的包吗?