My program needs to use multiple icsproxys. When many clients connect, I can feel that the response of the main window is very slow. I want to run icsproxy in multiple threads at the same time to speed up the execution efficiency of the program. What should I do?
I use the "ticsproxy" component, not "ticshttpproxy", because the packets I want to process are TCP protocol, not HTTP protocol. I try to use ticshttpproxy, but I can't receive anything in httpreqbody, httprespbody, httpreqhdr and httpresphdr events
================Here's how I use it====================
procedure TFrmMain.IcsProxyDataSendTar(Sender: TObject; ProxyClient: TProxyClient; var DataPtr: Pointer; var DataLen: Integer);
var
CMDData: TBytes;
CMDStr: string;
begin
CMDData := TBytes(DataPtr);
SetLength(CMDData, DataLen);
CMDStr := TEncoding.Default.GetString(CMDData);
//Here, I will modify the content of "cmdstr"
CMDStr := ReplaceText(CMDStr, "A", "B");
CMDData := TEncoding.Default.GetBytes(CMDStr);
DataLen := Length(CMDData);
DataPtr := @CMDData[0];
end;
============================================================
I read the comments in ticsprox and "targetbufxmit" and "sourcebufxmit", but I'm not sure how to deal with "dataptr: = @ ftarbuffer [0]". I even modified the source code of icsproxy, "procedure icsproxydatarecvtar (sender: tobject; proxyclient: tproxyclient; VAR dataptr: pointer; VAR datalen: integer);", Although I finally modified the data, I always felt that there was a simpler way.
I am using icsproxy component to proxy forward eth mining data. But I want to modify the data in the "icsproxydatasendtar" and "icsproxydatarecvtar" events and then forward it. How to operate? Can you give me a simple example?