Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dreamsxin/websocketclient
a websocket client by C language
https://github.com/dreamsxin/websocketclient
Last synced: 2 months ago
JSON representation
a websocket client by C language
- Host: GitHub
- URL: https://github.com/dreamsxin/websocketclient
- Owner: dreamsxin
- License: mit
- Created: 2015-03-04T00:29:28.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2014-04-28T05:40:18.000Z (over 10 years ago)
- Last Synced: 2023-03-17T03:07:31.345Z (almost 2 years ago)
- Language: C
- Size: 195 KB
- Stars: 5
- Watchers: 3
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
websocketClient
===============a websocket client by C language
##Usage
```c
#include
#include
#include "websocket.h"int main()
{
char *str = "hello websocket\n";
wsContext_t *ctx = NULL;
ctx = wsContextNew(NULL);
wsCreateConnection(ctx,"ws://10.0.0.150:1238/");
sendUtf8Data(ctx,str,strlen(str));
while(1)
{
int len = recvData(ctx,buff, 1*1024*1024);
if(len)
{
fprintf(stderr,"recv ok %d\n",len);
}
if(len < 0)
{
break;
}
}
wsContextFree(ctx);
return 0;
}
```