The nature of communication, communication methods, the principles and multiple characteristics of anonymous pipes (access control, pipe_buf, atomicity, half-duplex), pipe() + simulation implementation code, communication between multiple processes (anonymous pipes, simulation implementation code )

Table of Contents communication introduce Why should there be communication? the nature of communication How to communicate pipeline system V posix standard Signal pipeline introduce anonymous pipe Principle introduce process Implement — pipe() function prototype parameter return value mock code Features Used for communication between parent and child processes Provide access control When the buffer […]

Use PHP WorkerMan to build WebSocket full-duplex group chat communication (2)

A long time ago, before the WebSocket protocol was invented, when people made dynamic updates of real-time data on the Web, they generally used polling and long connections (Long Polling) to achieve it. Probably: Polling: The client continuously sends HTTP requests to the server, and the server returns the latest data. Long connection: The client […]

Protocol: WebSocket full-duplex communication network protocol

Project scenario: WebSocket is a network protocol for full-duplex communication between client and server. It allows real-time, bidirectional data transfer over a single TCP connection. In actual projects, specific requirements were encountered and the WebSocket network protocol was used. My requirement is that I need to continuously call the third-party interface, and the frequency and […]

C++ implements websocket single server single client full duplex communication (based on boost!!!)

Own environment: ubuntu18.04 + gcc7.5.0 + boost1.7,3 Environment configuration gcc or g++ are generally available, here mainly introduces the configuration method of boost Execute the following code: wget https://boostorg.jfrog.io/artifactory/main/release/1.73.0/source/boost_1_73_0.tar.bz2 –no-check-certificate tar xvf boost_1_73_0.tar.bz2 cd boost_1_73_0 ./bootstrap.sh –prefix=/usr ./b2 sudo ./b2 install cat /usr/include/boost/version.hpp | grep “BOOST_LIB_VERSION” After installation, it is found that an error will […]

WebSocket duplex communication enables users to log in and kick each other on different devices Server implementation

WebSocket duplex communication enables users to log in and kick each other on different devices. Server implementation introduction 1 Introduction to WebSocket 2 Server implementation 2.1 Add project dependencies 2.2 Create new ServerEndpointExporter and RedissonClient configuration beans 2.3 Create a new WebSocketServer component class 2.4 When the same user logs in, add the logic of […]

Linux – five communication methods between processes – (half-duplex pipes, named pipes, message queues, signals, shared memory), plus semaphores. Go directly to the code:

Unnamed pipe (half-duplex): (only the same program can run) Creating an unnamed pipe will generate a special file that only exists in memory #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> //int pipe(int pipefd[2]); //ssize_t write(int fd, const void *buf, size_t count); int main() { int pid; int fd[2]; char buf[128]; if(pipe(fd) == -1){ //Create […]

[Solved] When IDEA is conducting UDP half-duplex communication, the client input is normal, and the server accepts the solution that prints out garbled boxes.

During UDP half-duplex communication, the data received by the server appears as client data followed by a large series of block codes, as shown in the figure Client input works fine: The server accepts a box with garbled characters Client code: package javaweb2; import java.io.IOException; import java.net.DatagramPacket; import java.net.DatagramSocket; import java.net.InetAddress; import java.net.SocketException; import java.util.Scanner; […]