haXe API Documentation
Back | Index
class neko.net.ServerLoop<ClientData>
Available in neko
This class enables you to quickly create a custom server that can serve several clients in parallel. This server is using a single thread and process so the server itself processing is not parallel. Non-blocking sockets are used to ensure that a slow client does not block the others.
var clients : List<ClientData>
var listenCount : Int
This is the value of number client requests that the server socket listen for. By default this number is 10 but can be increased for servers supporting a large number of simultaneous requests.
var updateTime : Float
See update.
function new(?newData : _ : sys.net.Socket -> ClientData) : Void
Creates a server instance. The newData methods must return the data associated with the Client.
function clientDisconnected(d : ClientData) : Void
function clientWrite(s : sys.net.Socket, buf : haxe.io.Bytes, pos : Int, len : Int) : Void
function closeConnection(s : sys.net.Socket) : Bool
function onError(e : Dynamic) : Void
function processClientData(d : ClientData, buf : haxe.io.Bytes, bufpos : Int, buflen : Int) : Int
function run(host : sys.net.Host, port : Int) : Void
function update() : Void
static var DEFAULT_BUFSIZE : Int
Each client has an associated buffer. This is the initial buffer size which is set to 128 bytes by default.
static var MAX_BUFSIZE : Int
Each client has an associated buffer. This is the maximum buffer size which is set to 64K by default. When that size is reached and some data can't be processed, the client is disconnected.
Back | Index