Base class for server classes.

Constructor

new(serverHost:Host, serverPort:Int, requestHandlerClass:Class<BaseRequestHandler>)

Variables

@:value(false)threading:Bool = false

Handle each request in a new thread.

@:value(null)timeout:Null<Float> = null

A timeout to apply to the request socket, if not null.

Methods

handleRequest():Void

Handle one request, possibly blocking.

@:value({ pollInterval : 0.5 })serveForever(pollInterval:Float = 0.5):Void

Handle one request at a time until shutdown.

serverActivate():Void

Called by constructor to activate the server.

May be overridden.

shutdown():Void

Stops the serveForever() loop.

Blocks until the loop has finished. This must be called while serveForever() is running in another thread, or it will deadlock.