1# lws minimal raw netcat 2 3This example shows to to create a "netcat" that copies its stdin to 4a remote socket and prints what is returned in stdout. 5 6It has some advantage over the real netcat, it will wait 1s after stdin closes 7to print results that are in flight. 8 9## build 10 11``` 12 $ cmake . && make 13``` 14 15## usage 16 17``` 18 $ echo -e -n "GET / http/1.1\r\n\r\n"| ./lws-minimal-raw-netcat 19[2018/05/02 08:53:53:2665] USER: LWS minimal raw netcat [--server ip] [--port port] 20[2018/05/02 08:53:53:2667] NOTICE: Creating Vhost 'default' (no listener), 1 protocols, IPv6 off 21[2018/05/02 08:53:53:2703] USER: Starting connect... 22[2018/05/02 08:53:53:5644] USER: Connected to libwebsockets.org:80... 23[2018/05/02 08:53:53:5645] USER: LWS_CALLBACK_RAW_ADOPT 24[2018/05/02 08:53:53:5645] USER: LWS_CALLBACK_RAW_ADOPT_FILE 25[2018/05/02 08:53:53:5646] USER: LWS_CALLBACK_RAW_RX_FILE 26[2018/05/02 08:53:53:5646] USER: LWS_CALLBACK_RAW_CLOSE_FILE 27[2018/05/02 08:53:53:8600] USER: LWS_CALLBACK_RAW_RX (186) 28HTTP/1.1 301 Redirect 29server: lwsws 30Strict-Transport-Security: max-age=15768000 ; includeSubDomains 31location: https://libwebsockets.org 32content-type: text/html 33content-length: 0 34 35``` 36 37Note the example does everything itself, after 5s idle the remote server closes the connection 38after which the example continues until you ^C it. 39