Previous Up Next

startHTTPserver
This function creates a new http server on a specific port, and defines the callback function on requests : requests are firts bufferized on server side. When the whole request is received, the callback is evaluated with following arguments :
HTTPcon reference to the connection associated to the request
u0 user parameter
S request string

Then the callback should analyze this request (using 'strextr' for the header, and strfind to determine the beginning of post data). The callback must return a string :

Do not forget that the answer must start with a http header, such as :
HTTP/1.0 200 OK\13\10Server: SCOL HTTP server\13\10Content-Type: text/html\13\10\13\10

HTTPserver startHTTPserver (
Chn _channel_
I _port_
fun [HTTPcon u0 S] S _callback_
u0 _user_
)
Parameters

_channel_
any channel
_port_
Tcp-IP port number
_callback_
callback fired when request is received. Can be nil.
_user_
user parameter. Can be nil.
Return value

new http server

Error :