4 procedure BootWeb(url
:AnsiString
);
7 USES ServerLoop
,AsyncProcess
,MemStream
,sysutils
;
13 procedure EventTimeout
;
14 procedure Init(url
:ansistring
);
15 procedure DoneFreeSelf
;
18 procedure tWBS
.Init(url
:ansistring
);
19 var args
:array [0..2] of pchar
;
21 var stream
:^tMemoryStream
;
23 {todo: create buffer and stream, create arg list, set callback, run}
29 stream
^.Init(buffer
,0,1024);
30 async
.Init(@args
,stream
^);
31 async
.event
:=@EventAsync
;
32 Shedule(10000,@EventTimeout
); {10s timeout}
35 procedure tWBS
.EventAsync
;
37 UnShedule(@EventTimeout
);
39 if (async
.exitsignal
=0)and(async
.exitcode
=0) then begin
40 writeln('async success');
42 end else raise eXception
.createfmt('async failed, signal=%U code=%U',[async
.exitsignal
,async
.exitcode
]);
48 procedure tWBS
.EventTimeout
;
50 {timeout is automatically unsheduled}
53 raise eXception
.create('async timeout');
56 procedure tWBS
.DoneFreeSelf
;
58 FreeMem(async
.output
^.base
,async
.output
^.size
);
59 Dispose(async
.output
);
60 FreeMem(@self
,sizeof(self
));
63 procedure BootWeb(url
:AnsiString
);
71 BootWeb('http://localhost/');