All Projects → neverxie → tcpclient

neverxie / tcpclient

Licence: other
基于多线程的非阻塞 socket 编程

Programming Languages

c
50402 projects - #5 most used programming language
python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to tcpclient

Androidasyncsocketexamples
This project includes a few examples on how to create different types of sockets using AndroidAsync. It includes examples for a TCP client/server, TCP client with SSL and UDP client/server.
Stars: ✭ 152 (+442.86%)
Mutual labels:  socket, tcp-client
cAndroid
cAndroid is tool for control your PC by Android phone
Stars: ✭ 23 (-17.86%)
Mutual labels:  socket, tcp-client
tcp-net
Build tcp applications in a stable and elegant way
Stars: ✭ 42 (+50%)
Mutual labels:  socket, tcp-client
EasyFileTransfer
An easy way to transfer file with any size on network with tcp protocol.
Stars: ✭ 30 (+7.14%)
Mutual labels:  socket, tcp-client
Chat Socket
A simple chat room using java socket with the client-server paradigm
Stars: ✭ 24 (-14.29%)
Mutual labels:  socket, tcp-client
Bizsocket
异步socket,对一些业务场景做了支持
Stars: ✭ 469 (+1575%)
Mutual labels:  socket, tcp-client
Socketify
Raw TCP and UDP Sockets API on Desktop Browsers
Stars: ✭ 67 (+139.29%)
Mutual labels:  socket, tcp-client
Tinytcpserver
A small tcp server working under Mono or .NET (4.0) and provides hooks for handling data exchange with clients (works under mono and .net). Behaviour/protocol/reaction could be specified via custom C# script.
Stars: ✭ 14 (-50%)
Mutual labels:  socket, tcp-client
Oksocket
An blocking socket client for Android applications.
Stars: ✭ 2,359 (+8325%)
Mutual labels:  socket, tcp-client
ChatRoom
🎉简易Cli聊天室 - Python Socket实现
Stars: ✭ 153 (+446.43%)
Mutual labels:  socket
socketio
No description or website provided.
Stars: ✭ 23 (-17.86%)
Mutual labels:  socket
IQFeed.CSharpApiClient
IQFeed.CSharpApiClient is fastest and the most well-designed C# DTN IQFeed socket API connector available
Stars: ✭ 103 (+267.86%)
Mutual labels:  socket
Server
The whir.io chat server.
Stars: ✭ 15 (-46.43%)
Mutual labels:  socket
RxSocketClient
🚀Reactive Socket APIs for Android, Java and Kotlin, powered by RxJava2
Stars: ✭ 46 (+64.29%)
Mutual labels:  socket
ClusterWS-Client-Swift
☄️ Swift Client for ClusterWS - lightweight, fast and powerful framework for building scalable WebSockets applications in Node.js.
Stars: ✭ 20 (-28.57%)
Mutual labels:  socket
conf ndc 2018
NDC 2018 강연 자료
Stars: ✭ 24 (-14.29%)
Mutual labels:  socket
go-eventserver
A socket server which reads events from an event source and forwards them to the user clients when appropriate
Stars: ✭ 18 (-35.71%)
Mutual labels:  socket
socketbox
Write websocket app like as restful api. Inspired by express.
Stars: ✭ 14 (-50%)
Mutual labels:  socket
GenericProtocol
⚡️ A fast TCP event based buffered server/client protocol for transferring data over the (inter)net in .NET 🌐
Stars: ✭ 38 (+35.71%)
Mutual labels:  socket
sthread
sthread(simple-thread):支持高并发的协程网络库
Stars: ✭ 27 (-3.57%)
Mutual labels:  tcp-client

tcpclient

1、介绍

这是基于 RT-Thread 基于多线程的非阻塞 socket 编程示例,本文主要是介绍如何使用 tcpclient.c API。详情可了解:多线程的非阻塞 socket 编程

1.1、目录结构

名称 说明
inc 头文件目录
src 源代码目录
examples 例程目录

1.2、许可证

tcpclient 遵循 LGPLv2.1 许可,详见 LICENSE 文件。

1.3、依赖

  • 依赖 EasyLogger 软件包
  • 依赖 dfs 文件系统
  • RT-Thread 3.0+,对 bsp 无依赖

2、使用 tcpclient

测试 tcpclient.c 可参考例程代码,该代码位于: tcpclient_example.c

3、 API 介绍

3.1、启动 TCP 客户端任务

rt_tcpclient_t *rt_tcpclient_start(const char *hostname, rt_uint32_t port);

参数 描述
hostname IP 地址或域名
port 端口号
返回 描述
tcpclient 对象指针 创建 TCP 客户端任务成功
RT_NULL 创建 TCP 客户端任务失败

输入服务器 IP 地址 & (自定义的)端口号;服务器(网络调试助手)监听这个端口号

3.2、关闭 TCP 客户端任务

void rt_tcpclient_close(rt_tcpclient_t *thiz);

参数 描述
thiz tcp client 对象
返回 描述

通信结束,用户使用此 API 关闭资源

3.3、注册接收数据的回调函数

void rt_tcpclient_attach_rx_cb(rt_tcpclient_t *thiz, rx_cb_t cb);

参数 描述
thiz tcp client 对象
cb 回调函数指针
返回 描述

回调函数需要由用户来写,可参考例程代码

3.4、发送数据

rt_size_t rt_tcpclient_send(rt_tcpclient_t *thiz, const void *buff, rt_size_t len);

参数 描述
thiz tcp client 对象
buff 要发送的数据
len 数据长度
返回 描述
> 0 成功,返回发送的数据的长度
<= 0 失败

4、注意事项

通信完毕,需要用户自己调用 rt_tcpclient_close() API 释放资源

5、联系方式 & 感谢

  • 感谢:armink 制作了 EasyLogger 软件包
  • 维护:never
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].