Discussion on concurrency between TCPServer and select/poll/epoll in C language

Discussion on concurrency between TCPServer and select/poll/epoll in C language TCPServer Start a server First, let’s look at the implementation of TCPServer under the simplest Linux system: int main() {<!– –> int sockfd = socket(AF_INET, SOCK_STREAM, 0); struct sockaddr_in servaddr; memset( & amp;servaddr, 0, sizeof(struct sockaddr_in)); servaddr.sin_family = AF_INET; servaddr.sin_addr.s_addr = htonl(INADDR_ANY); servaddr.sin_port = htons(9999); […]

[Network] Custom protocol | Serialization and deserialization | Take tcpServer as an example

This article was first published in Mu Xue’s humble house Take the calculator service of tcpServer as an example to implement a custom protocol Before reading this article, please read tcpServer For the complete code of this article, see Gitee 1. Re-discuss tcp Note that the current description of tcp is for the sake of […]

Muduo source code analysis–TcpServer

TcpServer class: Tcp server class // Class used for external server programming class TcpServer {<!– –> public: using ThreadInitCallback = std::function<void(EventLoop *)>; enum Option {<!– –> kNoReusePort, kReusePort, }; TcpServer(EventLoop *loop, const InetAddress & listenAddr, const std::string & nameArg, Option option = kNoReusePort); ~TcpServer(); void setThreadInitCallback(const ThreadInitCallback & amp;cb) {<!– –> threadInitCallback_ = cb; } […]

Realization of TCP communication based on QT (TCPServer and TCPClient)

Article directory 1. Software introduction 1.1 TCPServer server interface 1.2 TCPClient client interface 1.3 The server and client establish a connection and communicate with each other Two, QT implements TCPServer and TCPClient 2.1 TCPClient client 2.1 TCPServer server 3. Code sharing Recently, because of the need to use the test TCPServer (TCP server) and TCPClient […]