- 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
+ packetbasesize is deprecated and should not be used anymore\r
}\r
packetbasesize = 1432;\r
- receivebufsize=packetbasesize*8;\r
+ receivebufsize=16384;\r
\r
var\r
absolutemaxs:integer=0;\r
{$ifdef mswindows}\r
sendflushlasterror:integer;\r
{$endif}\r
+\r
+ sendflushmaxwrite:integer;\r
+ //how much to write to the socket internally in one go. higher values allow faster throughput especially if latency is high\r
+ //but it also causes onsenddata to be called less often (typically once for every sendflushmaxwrite bytes)\r
+\r
function receivestr:tbufferstring; virtual;\r
procedure close;\r
procedure abort;\r
state := wsclosed;\r
fdhandlein := -1;\r
fdhandleout := -1;\r
+ sendflushmaxwrite := 16384;\r
end;\r
\r
destructor tlasio.destroy;\r
end;\r
datasentcalled := false;\r
\r
- lensent := sendq.get(data,packetbasesize*2);\r
+ lensent := sendflushmaxwrite;\r
+ if (lensent <= 0) then lensent := sendq.size;\r
+\r
+ lensent := sendq.get(data,lensent);\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