: : : : : now i am pasting the socket reading to the webbrowser
: : : : : but when the buffer get bigger, lag comes out
: : : : : here my read sub
: : : : :
procedure TfrmMain.SocketRead(Sender: TObject; Socket: TCustomWinSocket);
: : : : : var buffer:string;
: : : : : begin
: : : : : buffer := Socket.ReceiveText;
: : : : : IHTMLDocument2(WbBrowser.Document).body.innerHTML :=
: : : : : IHTMLDocument2(WbBrowser.Document).body.innerHTML + buffer;
: : : : : end;
: : : : : can you help me please?
: : : : :
: : : : This has several reasons. First it takes the socket longer to download a larger buffer. The second reason has something to do with the way the webbrowser gets the document. Each time you add a buffer, the entire (!) innerHTML is re-parsed. Since the innerHTML gets bigger and bigger, the parsing takes longer and longer.
: : : : You can speed it up by using some sort of HTML index, which splits the innerHTML into smaller parts. Or you could first read the entire innerHTML into a separate string, and then parse the HTML into the webbrowser (thus removing the re-parse lag). Or if that fails buy a faster computer. The lag due to the net-communication speed is very hard to decrease, but it is possible using a compression algorithm.
: : : :
: : : i know that i should do that alone, but i am rookie :/
: : : can you give me an example... please? please please please :D
: : :
: : is there anyway to add lines without copying all stuff ?
: : liek richededit.addlines or something like it
: : or a way to use string and free strings to my webbrowser
: :
: : please :)
: :
: You need to add a new string field to the form containing the webbrowser and the socket. Then in the SocketRead() event you change the code to:
:
: procedure TfrmMain.SocketRead(Sender: TObject; Socket: TCustomWinSocket);
: var buffer:string;
: begin
: buffer := Socket.ReceiveText;
: HTMLBuffer := HTMLBuffer + buffer;
: end;
:
: Once the socket has finished reading the text you perfrom an assignment to the innerHTML. I don't know exactly which event is fired, when a socket is finished receiving data.
:
i had an idea, but it didn't work, it still lagging me out
i put a richedit in the form, invisible one
look my receiving sub:
procedure TfrmMain.SocketRead(Sender: TObject; Socket: TCustomWinSocket);
var buffer, buf, copy:string;
x, y, start:integer;
begin
buffer := Socket.ReceiveText;
edit.Lines.Add(buf);
IHTMLDocument2(WbBrowser.Document).body.innerHTML := edit.text;
end;
then i tried not using the webbrowser as buffer, the richedit didn't lag me, no matter how much i flooded...
i need to debug this :/
help me hehe
please :D