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); […]
Tag: tcpserver
[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 […]
QT network programming how to use QT6 framework QTcpServer and QTcpSocket network programming to realize variable length data packet sending and receiving: take user registration and login as an example to explain
QT network programming how to use QT6 framework QTcpServer and QTcpSocket network programming to realize variable length data packet sending and receiving: take user registration and login as an example to explain Introduction This article will introduce how to use the QT6 framework QTcpServer and QTcpSocket for network programming to realize variable-length data packet sending […]
[Linux] Realize daemon process | Take tcpServer as an example
This article was first published in Mu Xue’s humble house This article will use the tcp server code as the basis to describe how to daemonize the process and run it in the background 1. Daemon The so-called daemon process is a process that has nothing to do with other processes; it runs independently in […]
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; } […]
Muduo library source code analysis (eight) – TcpServer class
TcpServer class Key points The main function of the TcpServer class is to manage the entire server and do the following operations: Manage TcpConnection obtained by accept(2) TcpServer is for direct use by users, and its lifetime is controlled by users Set mainLoop, and use mainLoop to manage new connections Initialize the Acceptor corresponding to […]
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 […]
Use QTcpSocket and QTcpServer to transfer large files
Qt found in the actual use of Tcp communication that the sending end and the receiving end are not in one-to-one correspondence, and there will be a situation where sending multiple times only corresponds to one time, and when the speed of the sending end far exceeds the receiving end, the program will crash. Small […]