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.
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.
This method can be used instead of writing directly to the socket. It ensures that all the data is correctly sent. If an error occurs while sending the data, no exception will occur but the client will be gracefully disconnected.
Called when an error occurred. This enable you to log the error somewhere.
By default the error is displayed using
processClientData (d:ClientData, buf:Bytes, bufpos:Int, buflen:Int):Int
This method is called when some data has been read into a Client buffer. If the data can be handled, then you can return the number of bytes handled that needs to be removed from the buffer. It the data can't be handled (some part of the message is missing for example), returns 0.
staticDEFAULT_BUFSIZE:Int = 128
Each client has an associated buffer. This is the initial buffer size which is set to 128 bytes by default.