README.md
1# lws minimal ws server raw vhost
2
3This demonstrates setting up a vhost to listen and accept raw sockets.
4Raw sockets are just sockets... lws does not send anything on them or
5interpret by itself what it receives on them. So you can implement
6arbitrary tcp protocols using them.
7
8This isn't very useful standalone as shown here for clarity, but you can
9freely combine a raw socket vhost with other lws server
10and client features and other vhosts handling http or ws.
11
12Becuase raw socket events have their own callback reasons, the handlers can
13be integrated in a single protocol that also handles http and ws
14server and client callbacks without conflict.
15
16## build
17
18```
19 $ cmake . && make
20```
21
22## usage
23
24 -s means listen using tls
25
26```
27 $ ./lws-minimal-raw-vhost
28[2018/03/22 14:49:47:9516] USER: LWS minimal raw vhost
29[2018/03/22 14:49:47:9673] NOTICE: Creating Vhost 'default' port 7681, 1 protocols, IPv6 off
30[2018/03/22 14:49:52:3789] USER: LWS_CALLBACK_RAW_ADOPT
31[2018/03/22 14:49:57:4271] USER: LWS_CALLBACK_RAW_CLOSE
32```
33
34```
35 $ nc localhost 7681
36hello
37hello
38```
39
40Connect one or more sessions to the server using netcat... lines you type
41into netcat are sent to the server, which echos them to all connected clients.
42
43