\r
\r
const\r
- receivebufsize=1460*8;\r
+ {how this number is made up:\r
+ - ethernet: MTU 1500\r
+ - be safe for either "ethernet v1" or "PPPoE", both take 8 bytes\r
+ - IPv6 header: 40 bytes (IPv4 is 20)\r
+ - TCP/UDP header: 20 bytes\r
+ }\r
+ packetbasesize = 1432;\r
+ receivebufsize=packetbasesize*8;\r
\r
var\r
absoloutemaxs:integer=0;\r
\r
//procedure messageloop;\r
function Receive(Buf:Pointer;BufSize:integer):integer; virtual;\r
- procedure flush;virtual;{$ifdef win32} abstract;{$endif}\r
+ procedure flush;virtual;\r
procedure dodatasent(wparam,lparam:longint);\r
procedure doreceiveloop(wparam,lparam:longint);\r
procedure sinkdata(sender:tobject;error:word);\r
begin\r
if state <> wsconnected then exit;\r
\r
- lensent := sendq.get(data,2920);\r
+ lensent := sendq.get(data,packetbasesize*2);\r
if assigned(data) then result := myfdwrite(fdhandleout,data^,lensent) else result := 0;\r
\r
if result = -1 then lensent := 0 else lensent := result;\r
end;\r
end;\r
\r
-{$ifndef win32}\r
- procedure tlasio.flush;\r
- var\r
- fds : fdset;\r
- begin\r
- fd_zero(fds);\r
- fd_set(fdhandleout,fds);\r
- while sendq.size>0 do begin\r
- select(fdhandleout+1,nil,@fds,nil,nil);\r
- if sendflush <= 0 then exit;\r
- end;\r
- end;\r
+procedure tlasio.flush;\r
+{$ifdef win32}\r
+type fdset = tfdset;\r
{$endif}\r
+var\r
+ fds : fdset;\r
+begin\r
+ fd_zero(fds);\r
+ fd_set(fdhandleout,fds);\r
+ while sendq.size>0 do begin\r
+ select(fdhandleout+1,nil,@fds,nil,nil);\r
+ if sendflush <= 0 then exit;\r
+ end;\r
+end;\r
\r
procedure tlasio.dodatasent(wparam,lparam:longint);\r
begin\r