{$ifdef VER1_0}\r
linux,\r
{$else}\r
- baseunix,unix,unixutil,\r
+ baseunix,unix,unixutil,sockets,\r
{$endif}\r
fd_utils,\r
{$endif}\r
- classes,pgtypes,bfifo;\r
+ classes,pgtypes,bfifo,ltimevalstuff;\r
procedure processtasks;\r
\r
\r
TSendData = procedure (Sender: TObject; BytesSent: Integer) of object;\r
\r
tlcomponent = class(tcomponent)\r
- private
- procedure releasetaskhandler(wparam,lparam:longint);
+ private\r
+ procedure releasetaskhandler(wparam,lparam:longint);\r
public\r
procedure release; virtual;\r
destructor destroy; override;\r
lasterror:integer;\r
destroying:boolean;\r
recvbufsize:integer;\r
- function receivestr:string; virtual;\r
+ function receivestr:tbufferstring; virtual;\r
procedure close;\r
procedure abort;\r
procedure internalclose(error:word); virtual;\r
procedure dup(invalue:longint);\r
\r
function sendflush : integer;\r
- procedure sendstr(const str : string);virtual;\r
- procedure putstringinsendbuffer(const newstring : string);\r
+ procedure sendstr(const str : tbufferstring);virtual;\r
+ procedure putstringinsendbuffer(const newstring : tbufferstring);\r
function send(data:pointer;len:integer):integer;virtual;\r
procedure putdatainsendbuffer(data:pointer;len:integer); virtual;\r
procedure deletebuffereddata;\r
var\r
timerwrapperinterface : ttimerwrapperinterface;\r
type\r
- {$ifdef win32}\r
- ttimeval = record\r
- tv_sec : longint;\r
- tv_usec : longint;\r
- end;\r
- {$endif}\r
tltimer=class(tlcomponent)\r
protected\r
\r
{$ifndef win32}\r
{$include unixstuff.inc}\r
{$endif}\r
-{$include ltimevalstuff.inc}\r
\r
\r
{!!! added sleep call -beware}\r
inherited destroy;\r
end;\r
\r
-procedure tlcomponent.releasetaskhandler(wparam,lparam:longint);
-begin
- free;
-end;
+procedure tlcomponent.releasetaskhandler(wparam,lparam:longint);\r
+begin\r
+ free;\r
+end;\r
\r
\r
procedure tlcomponent.release;\r
begin\r
- addtask(releasetaskhandler,self,0,0);
+ addtask(releasetaskhandler,self,0,0);\r
end;\r
\r
procedure tlasio.release;\r
end;\r
end;\r
\r
-procedure tlasio.sendstr(const str : string);\r
+procedure tlasio.sendstr(const str : tbufferstring);\r
begin\r
putstringinsendbuffer(str);\r
sendflush;\r
end;\r
\r
-procedure tlasio.putstringinsendbuffer(const newstring : string);\r
+procedure tlasio.putstringinsendbuffer(const newstring : tbufferstring);\r
begin\r
if newstring <> '' then putdatainsendbuffer(@newstring[1],length(newstring));\r
end;\r
// fdstestr : fdset;\r
// fdstestw : fdset;\r
begin\r
- if state <> wsconnected then exit;\r
+ if state <> wsconnected then begin\r
+ result := -1;\r
+ exit;\r
+ end;\r
\r
lensent := sendq.get(data,packetbasesize*2);\r
if assigned(data) then result := myfdwrite(fdhandleout,data^,lensent) else result := 0;\r