lib/socket: use standard type names instead of local typedefs

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
lib/socket: update style of the native module & move comments to doc

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
lib/socket: rename prefix `FF` to `Native` per latest best practices

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
lib/socket: replace `NativeSocketAcceptResult` by a Nit class

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
lib/socket: clean up `native_accept` to better manage failed accept

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
lib/socket: intro `NativeSocket::non_blocking` and `tcp_nodelay`

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
lib/socket: distinguish `TCPServer` from `TCPStream`

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
lib/socket: intro `flush` and `blocking=`

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
lib/socket: minimal update to `SocketObserver` API and note some problems

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
lib/socket: update examples to the latest API

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
lib/socket: add an easier server example

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
lib/socket: update socket clients

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Merge: lib/socket: fix, update style and intro features

This is a pretty big update to the `socket` module. It appeared to be broken. Did someone test it since the last modifications to streams and read_line?

* Update and cleanup the style in the first 3 or 4 commits.
* Fix (some of) what was broken.
* Revamp the API with a distinction between listening sockets and stream sockets (making it closer to Ruby and C#). This is the most important commit "lib/socket: distinguish `TCPServer` from `TCPStream`".
* Intro additionnal features used by Mineit: non-blocking `TCPServer` sockets and `TCPStream::flush`.

Still to do:
* Add `Error` support to the API.
* Rename `socket_c` to `native_socket`.
* Fix `SocketObserver` and underlying C implementation.

Pull-Request: #1063
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>