Code Example
Code: Select all
oSocket = TSocket():New(80 )
oSocket:bAccept = { | oSocket | oClient := TSocket():Accept( oSocket:nSocket ),;
oClient:Cargo := 0,;
oClient:bRead := { | oSocket | OnRead( oSocket ) },;
oClient:bClose := { | oSocket | OnClose( oSocket ) } }
oSocket:Listen()
ACTIVATE WINDOW ownd
close all
return nil
function OnRead( oSocket )
local cData := oSocket:GetData()
local cToken
msginfo(cData)
cbuffer=" HELLO "
oSocket:SendData( "HTTP/1.0 200 OK" + CRLF + ;
"Server: FiveWin WebServer 1.0" + CRLF + ;
"Content-type: text/html" + CRLF + ;
"Content-length: " + Str( Len( cBuffer ) ) + CRLF + ;
"" + CRLF + cBuffer )
// oSocket:close()
return nil
//------------------------------------------------------------------------//