I am trying to find a example which will explain me how to implement Client using libwebsocket, But I didn't get any convincing code. Is there any link that I can refer to?
相关问题
- Multiple sockets for clients to connect to
- What is the best way to do a search in a large fil
- glDrawElements only draws half a quad
- Index of single bit in long integer (in C) [duplic
- Equivalent of std::pair in C
Corrected the code example by Ren-Wei Luo to work with
libwebsockets 1.6
Tested on Ubuntu 14.04
example-server.c
example-client.c
makefile
I have code a simple echo server and client using libwebsockets in pure C.
The server side will do echo after it received the data from client.
The client side will write a hello message to server after the connection is established. Then after 2 seconds sleep, the client will call libwebsocket_callback_on_writable. You can see how it works.
I just upload the code on my Google drive.
My google drive link
You can compile the code by using below commands in the Terminal.
Or, just use make on Terminal.