H
hjp0214
Unregistered / Unconfirmed
GUEST, unregistred user!
怎样处理Socket传送大于4096的数据问题.
现在客户端是这样处理的:
procedure TfrmClient.ClientRead(Sender: TObject; Socket: TCustomWinSocket);
var
iPackageSize: Integer;
TempBuf: ByteArray;
begin
while socket.ReceiveLength>0 do
begin
iPackageSize := socket.ReceiveLength;
FillChar(TempBuf,length(TempBuf),0);
Socket.ReceiveBuf(TempBuf,iPackageSize);
TranMemBuf(TempBuf,iPackageSize);//解析报文过程
end;
end;
socket.ReceiveLength>8192
服务端是多线程的非阻塞发送,不断向客户端发送数据.
感觉到socket.ReceiveLength=0后才能处理报文解析.这样很容易缓存区溢出.
不知道有什么好办法处理???分数不多,但急需解决啊.
现在客户端是这样处理的:
procedure TfrmClient.ClientRead(Sender: TObject; Socket: TCustomWinSocket);
var
iPackageSize: Integer;
TempBuf: ByteArray;
begin
while socket.ReceiveLength>0 do
begin
iPackageSize := socket.ReceiveLength;
FillChar(TempBuf,length(TempBuf),0);
Socket.ReceiveBuf(TempBuf,iPackageSize);
TranMemBuf(TempBuf,iPackageSize);//解析报文过程
end;
end;
socket.ReceiveLength>8192
服务端是多线程的非阻塞发送,不断向客户端发送数据.
感觉到socket.ReceiveLength=0后才能处理报文解析.这样很容易缓存区溢出.
不知道有什么好办法处理???分数不多,但急需解决啊.