From: beware Date: Sat, 22 Nov 2008 17:11:59 +0000 (+0000) Subject: fixed line endings. made flush work on win32. made packet base size X-Git-Url: http://www.lcore.org/git/lcore.git/commitdiff_plain/9b641f7a6cda5781002a12c901addc01787003e9?ds=inline fixed line endings. made flush work on win32. made packet base size constant. git-svn-id: file:///svnroot/lcore/trunk@18 b1de8a11-f9be-4011-bde0-cc7ace90066a --- diff --git a/lcore.pas b/lcore.pas index f6b0342..da0fd66 100755 --- a/lcore.pas +++ b/lcore.pas @@ -35,7 +35,8 @@ interface const - receivebufsize=1460*8; + packetbasesize = 1460; + receivebufsize=packetbasesize*8; var absoloutemaxs:integer=0; @@ -121,7 +122,7 @@ interface //procedure messageloop; function Receive(Buf:Pointer;BufSize:integer):integer; virtual; - procedure flush;virtual;{$ifdef win32} abstract;{$endif} + procedure flush;virtual; procedure dodatasent(wparam,lparam:longint); procedure doreceiveloop(wparam,lparam:longint); procedure sinkdata(sender:tobject;error:word); @@ -490,7 +491,7 @@ var begin if state <> wsconnected then exit; - lensent := sendq.get(data,2920); + lensent := sendq.get(data,packetbasesize*2); if assigned(data) then result := myfdwrite(fdhandleout,data^,lensent) else result := 0; if result = -1 then lensent := 0 else lensent := result; @@ -617,19 +618,20 @@ begin end; end; -{$ifndef win32} - procedure tlasio.flush; - var - fds : fdset; - begin - fd_zero(fds); - fd_set(fdhandleout,fds); - while sendq.size>0 do begin - select(fdhandleout+1,nil,@fds,nil,nil); - if sendflush <= 0 then exit; - end; - end; +procedure tlasio.flush; +{$ifdef win32} +type fdset = tfdset; {$endif} +var + fds : fdset; +begin + fd_zero(fds); + fd_set(fdhandleout,fds); + while sendq.size>0 do begin + select(fdhandleout+1,nil,@fds,nil,nil); + if sendflush <= 0 then exit; + end; +end; procedure tlasio.dodatasent(wparam,lparam:longint); begin diff --git a/lsocket.pas b/lsocket.pas index 7438c26..898e983 100755 --- a/lsocket.pas +++ b/lsocket.pas @@ -704,6 +704,6 @@ end; result := winsock.recv(fd,buf,size,0); end; {$endif} - + end.