Z
zeroworld
Unregistered / Unconfirmed
GUEST, unregistred user!
当用Tserversocket和Tclientsocket做代理服务器时
当访问的网页很大时,就出现传输塞住的现象,别的连接都不能访问哦
请问该怎么解决,主要问题出在这个部分,通讯方式为
nonblocking
procedure TfrmMain.ClientSocket1Read(Sender: TObject;
Socket: TCustomWinSocket);
var
i, j,n: integer;
rec_bytes: integer; {传回的数据块长度}
rec_Buffer: array[0..2043] of char; {传回的数据块缓冲区}
rec:variant;
begin
for i := 1 to sessions do
if (session[i - 1].CSocket.tag = socket.SocketHandle) and
session[i - 1].Used then
begin
n:=socket.ReceiveLength;
rec_bytes := socket.ReceiveBuf(rec_buffer, 2043); {接收数据}
for j := 1 to serversocket1.Socket.ActiveConnections do
if serversocket1.Socket.Connections[j - 1].SocketHandle =
session[i- 1].SS_Handle then
begin
serversocket1.Socket.Connections[j - 1].SendBuf(rec_buffer,
rec_bytes); {发送数据}
break;
end;
break;
end;
end;
当访问的网页很大时,就出现传输塞住的现象,别的连接都不能访问哦
请问该怎么解决,主要问题出在这个部分,通讯方式为
nonblocking
procedure TfrmMain.ClientSocket1Read(Sender: TObject;
Socket: TCustomWinSocket);
var
i, j,n: integer;
rec_bytes: integer; {传回的数据块长度}
rec_Buffer: array[0..2043] of char; {传回的数据块缓冲区}
rec:variant;
begin
for i := 1 to sessions do
if (session[i - 1].CSocket.tag = socket.SocketHandle) and
session[i - 1].Used then
begin
n:=socket.ReceiveLength;
rec_bytes := socket.ReceiveBuf(rec_buffer, 2043); {接收数据}
for j := 1 to serversocket1.Socket.ActiveConnections do
if serversocket1.Socket.Connections[j - 1].SocketHandle =
session[i- 1].SS_Handle then
begin
serversocket1.Socket.Connections[j - 1].SendBuf(rec_buffer,
rec_bytes); {发送数据}
break;
end;
break;
end;
end;