项目作者: novice1011

项目描述 :
TCP server in c language client disconnect detection and restart new server
高级语言: C++
项目地址: git://github.com/novice1011/tcp-server-c.git
创建时间: 2019-10-27T13:59:25Z
项目社区:https://github.com/novice1011/tcp-server-c

开源协议:

下载


TCP server C

TCP server using c language, also equipped with reconnect when client disconnect

This code is only for receiving message from client. Also, this code using blocking read mode

If you want non-blocking read on server side, use:

  1. int connfd = accept4(sockfd, (SA*)&cli, &len, SOCK_NONBLOCK);

and this is for the client side

  1. int sockfd = socket(AF_INET, SOCK_STREAM | SOCK_NONBLOCK, 0);