关于socketpair 的实验(基于linux)

Linux socketpair详解 socketpair函数概要如下: #include  定义一些C宏常量 #include  定义socketpair函数原型 int socketpair(int domain, int type, int protocol, int sv[2]); socketpair函数需要四个参数: domain-套接口的域 type-套接口类型 protocol-使用的协议 sv[2 阅读详情
实验结果:

向s0写入数据,则可从s1读到数据,反之亦然。
如果没有向s0写入数据,则读取s1的动作会阻塞住,直到s0被写入数据。
在进程A中向s0写入数据后,也可在进程A中从s1把该数据读出来,当然也可以在进程B中从s1把该数据读出来。作为进程间通信的方法,通常的用法都是后者。
这样看来,通讯似乎是单向的,其实socketpair的全双工用法也很简单:
让进程A使用s0,则进程A可向s0写入,也可从s0读取。让进程B使用s1,则进程B可向s1写入,也可从s1读取。
如此,
进程A向s0写入的内容,便可由进程B从s1读取出来。
进程B向s1写入的内容,便可由进程A从s0读取出来。
即实现了AB两个进程间的全双工通讯。

向s0写入数据的过程中,如果未从s1读取,则s0的写指针会随着每次写入动作后移,这样保证了新写入的数据不会覆盖旧数据。一旦从s1读取数据的动作发生,则s0的写指针立刻回到起始位置!也就是说每次对s1的读取动作都会导致s0的写指针复位。但是注意,写指针复位并不会导致s0的旧数据丢失,只表示新的写入数据会覆盖旧数据。


代码:

#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
#include <termios.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <utils/Log.h>
#include <cutils/sockets.h>
#include <time.h>
#include <cutils/properties.h>

#define BUF_SIZE 30

int main(void)
{
	int socket_pair[2];
	char * string_1 = "abcdefghijk";
	char * string_2 = "ABCDEFGHIJK";
	char * buf = (char*)calloc(1 , BUF_SIZE);//need to check memory allocation errors!
	pid_t ret_val;
	pid_t pid_parent = -1;
	pid_t pid_child = -1;

/*============	socketpair init ============*/

	if(-1 == socketpair(AF_UNIX,SOCK_STREAM,0,socket_pair)) {
		printf("create unnamed socket pair failed:%s\n",strerror(errno));
		exit(-1);
	}

/*============	fork a new process ============*/

	ret_val = fork();
	if(ret_val < 0) {
		printf("Fork failed:%s\n", strerror(errno));
		exit(-1);
	}

	if(ret_val > 0) {
		pid_parent = getpid();
		printf("this is the PARENT process (pid=%4d)\n", pid_parent);
	}
	else {
		pid_child = getpid();
		printf("this is the CHILD process (pid=%4d)\n", pid_child);
		//close(s[0]);
	}

/*============  the work of each process ============*/

	if(pid_parent == getpid()) {// the parent process
		int i = 0;
		char* p = NULL;
		p = string_1;

		close(socket_pair[1]);

		while(i<10) {

			printf("				PARENT: sleep...\n");
			sleep(2);
			printf("				PARENT: awake...\n");

			printf("				PARENT: writing...\n");
			if((write(socket_pair[0] , p , 1)) == -1 ) {
				printf("				PARENT: write to socket_pair[0] ERROR: %s\n", strerror(errno));
				exit(-1);
			}
			else {
				printf("				PARENT: write to socket_pair[0]: %c\n", *p);
			}

			printf("				PARENT: reading...\n");
			if((read(socket_pair[0] , buf , BUF_SIZE)) == -1 ) {
				printf("				PARENT: read from socket_pair[0] ERROR: %s\n", strerror(errno));
				exit(-1);
			}
			else {
				printf("				PARENT: read from socket_pair[0]: %s\n", buf);
			}

			i++;
			p++;
		}
		printf("				PARENT: exit\n");
	}
	else if(pid_child == getpid()) {// the child process
		int i = 0;
		char* p = NULL;
		p = string_2;

		close(socket_pair[0]);

		while(i<10) {
			printf("CHILD: reading...\n");
			if((read(socket_pair[1] , buf , BUF_SIZE)) == -1 ) {
				printf("CHILD: read from socket_pair[1] ERROR: %s\n", strerror(errno));
				exit(-1);
			}
			else {
				printf("CHILD: read from socket_pair[1]: %s\n", buf);
			}

			printf("CHILD: writing...\n");
			if((write(socket_pair[1] , p , 1)) == -1 ) {
				printf("CHILD: write to socket_pair[1] ERROR: %s\n", strerror(errno));
				exit(-1);
			}
			else {
				printf("CHILD: write to socket_pair[1]: %c\n", *p);
			}

			printf("CHILD: sleep...\n");
			sleep(2);
			printf("CHILD: awake...\n");

			i++;
			p++;
		}
		
		printf("CHILD: exit\n");
	}

	exit(0);
}





Linux网络编程 -- socketpair的使用 socketpair的使用Linux实现了一个源自BSD的socketpair调用,可以实现在同一个文件描述符中进行读写的功能。 该系统调用能创建一对已连接的UNIX族socket。 在Linux中,完全可以把这一对socket当成pipe返回的文件描述符一样使用,唯一的区别就是这一对文件描述符中的任何一个都可读和可写,函数原型如下:#include <sys/types.h> #include 阅读详情

相关推荐

【C语言】socketpair 的系统调用

它是一个预处理器宏,用来定义一个带有四个参数的系统调用接口。这个宏展开后,会生成向操作系统注册 socketpair 系统调用所需的所有内核代码。2.

数字人生 1258

socketpair的使用

socketpair函数概要如下:#include #include int socketpair(int domain, int type, int protocol, int sv[2]);sys/types.h文件需要用来定义一些C宏常量。sys/socket.h文件必须包含进来定义socketpair函数原型。socketpair函数需要四个参数。他们是:套接口的域套接口类型使用的协议指向

2万+

socketpair深度解析:Linux中的“对讲机“创建器

<摘要> socketpair函数是Linux系统中的"双向通信管道创建器",能够创建一对相互连接的套接字,就像给两个进程提供了一对专用的对讲机。与普通管道不同,socketpair创建的套接字对支持全双工通信,两端都可以自由地发送和接收数据。这个函数在进程间通信、线程间通信、文件描述符传递等场景中发挥着重要作用,特别是在需要双向数据流动的复杂应用中。

weixin_42108533的博客 1040

linux socketpair(UNIX domain socket)

/* g++ sp_block.cpp -g -O0 -o sp_block */ #include #include // socketpair #include #include // fork #include #include // atoi #include // errno #include // strerror #include int RecvFD(i

OSSRS 2370

手把手教你搞定EMC EFT测试:从电源线到信号线的完整整改实战(附常见失败原因)

本文详细解析了EMC EFT测试中的常见问题及整改措施,从电源线到信号线的完整实战方案。通过四步定位法和成本最优整改策略,帮助工程师有效应对电快速脉冲群干扰,提升产品通过率并降低成本。

weixin_30920597的博客 501

3D医学影像分割实战:从数据预处理到模型训练全流程解析

本文详细解析了3D医学影像分割的全流程,从数据预处理到模型训练,重点介绍了nnUNet框架的应用技巧。通过实战案例,帮助开发者掌握如何处理复杂的.nii.gz文件格式、优化数据预处理流程以及高效训练3D分割模型,特别适合医学影像分析领域的从业者参考。

weixin_29098367的博客 223

Linux下socketpair系统API调用使用说明

socketpair系统API调用使用说明

hsy12342611的专栏 1310

2025东三省D题深圳杯数学建模实战解析:基于多模型融合的法医STR混合样本智能识别系统

本文深入解析了2025年东三省数学建模竞赛D题,即深圳杯赛题,聚焦于法医STR混合样本的智能识别挑战。文章系统阐述了构建一个基于多模型融合的智能识别系统的完整流程,涵盖贡献者人数判定、DNA贡献比例估计、个体基因型推断以及STR谱图去噪四大核心步骤。通过融合高斯混合模型、随机森林、非负矩阵分解、小波变换与深度学习等多种技术,并强调特征工程的重要性,为破解法医DNA混合样本分析这一行业难题提供了清晰的数学建模与AI实战思路。

weixin_29050271的博客 392

socketpair

socketpair:建立一对匿名的已经连接的套接字 #include sys/types.h>  #include sys/socket.h> int socketpair(int d, int type, int protocol, int sv[2]); 1)UNIX域 2)SOCK_STREAM SOCK_DGRAM 3)对于socketpair函数,protocol参

今晚打老虎 330

幸狐RV1106开发板实战:5分钟搞定Yolo8模型部署(附避坑指南)

本文详细介绍了在幸狐RV1106开发板上快速部署YOLOv8模型的实战流程。通过RKNN-Toolkit2工具链,将ONNX模型转换为RV1106 NPU专用的RKNN格式,并完成交叉编译与上板运行。文章重点分享了环境搭建、模型转换的关键步骤以及常见的避坑指南,帮助开发者高效实现边缘AI目标检测应用。

weixin_28677451的博客 918

Python控制tek示波器(1)

如何使用Python来控制tek示波器

m0_47441496的博客 3379

【socketpair函数介绍及使用】

socketpair函数介绍及使用函数原型进程间通信线程间通信   Linux环境下使用socketpair函数创造一对未命名的、相互连接的UNIX域套接字。   管道历史上,它们是半双工的(数据只能在一个方向上流动),但是现在也有全双工管道。管道只能在具有共同祖先的两个进程之间使用,通常一个管道由一个进程创建,在进程调用fork之后,这个管道就你能在父进程和子进程之间使用了。 函数原型 #include <sys/types.h> #include <sys/socket.h> /

qq_43899283的博客 2149

搞定ESD(二):ESD干扰机理分析

大家好,我是记得诚。上文介绍了ESD的基本知识,对ESD的测试标准进行了解析,包括静电发生器的介绍,实验布置要求,静电放电实验的实施及判定等内容。本文主要介绍ESD的干扰机理。

记得诚 4304

Linux网络编程实验——进程池实现服务器

  这是学习Linux网络编程以来的第一个相对比较长的实验。途中遇到了许多乱七八糟的问题以致感觉自己迷迷糊糊的,所以打算把这些记下来算作梳理。   实验取自《Linux高性能服务器编程》15.3节   代码已经全部上传到我的github仓库,文后附上链接。 Something interesting 1.不像使用pipe()创建的管道两边只能一个读一个写,socketpair第一个参数选用PF_U...

qq_40309727的博客 314

YOLOv改进 | YOLOv11更换主干Backbone之MobileNetV2(轻量化主干网络结构--高效轻量移动模型)

本文提出将YOLOv11的主干网络替换为轻量化的MobileNetV2,以提升模型在移动端设备的部署效率。MobileNetV2通过倒残差结构和线性瓶颈层,显著减少了计算量和参数量(降至1M~3M),同时保持多尺度特征提取能力。实验表明,改进后的模型在移动设备上可实现20-30 FPS的实时检测,适用于手机APP、无人机和工业监控等场景。核心代码展示了倒残差块的实现,通过深度可分离卷积和通道扩展/压缩实现高效特征提取。

走向CTO的路上... 1464

动力学约束下的运动规划算法——状态栅格规划器(State Lattice Planner)

A*、RRT等算法建立的用于路径搜索的图模型是不考虑机器人的动力学约束的,其构建的图模型的两个相邻节点之间的路径可能是不可行的,或者很难被机器人跟踪的,现在我们想要使得图中相邻两个节点间的连接是一种满足动力学约束的可行的连接,那么如何构建一个这样的图呢? 构建这样的图通常有两种方法:第一种是基于控制空间的采样(正向方法)

慕羽★的博客 3108

fork生成子进程与执行exec子进程的区别

背景 项目中想使用多进程的模式。一个控制进程,加上N个工作进程。即是master+worker进程的模式,与nginx的进程模式类似的思路。master创建并管理worker进程,而且他们之间需要能够进行通信。设计思路如下图所示: 遇到问题 如何创建woker进程 linux系统下,创建进程,肯定使用fork来做系统调用。然后fork之后,我们通过ps看到子进程名称也是master,从使用角度来...

werflychen的专栏 1532

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

linux下socketpair通信

函数原型: #include <sys/types.h> /* See NOTES */ #include <sys/socket.h> int socketpair(int domain, int type, int protocol, int sv[2]); 函数功能描述: socketpair函数创建...

weixin_42377147的博客 286

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

大中型超市收银系统(可直接运行)

光步前台收银系统系统功能:商品销售、商品退货、挂单、收银员权限、会员销售、单品取消、整单取消、商品查询、脱机销售、脱机数据上传,基本资料下载,开钱箱、小票打印、收款结算,支持多币种付款方式(现金、储值卡、礼券、微信等),支持多种促销。运行环境:.net 4.0登陆信息用户名:1001 密码:123456内置商品信息,商品编码可输入00001000 - 00010000,测试效果相关功能键F5 结算 F9挂单 F11商品查询 F8退货 Insert单品取消 Del整单取消 F12开钱箱F2 会员 Ctrl+Z退出系统 Home 锁屏 相关源码待公开

linux编程基础:使用socketpair实现双向通讯

socketpair是linux提供的一种双向通讯机制,它通过socket实现双向通讯。socketpair本身虽然实现了双向通讯的功能,但是也存在一些限制:比如只能在一个进程的线程之间进行双向通讯或者是在具有亲缘关系的进程间进行通讯。所以socketpair很少情况下会单独使用,它往往需要和其他编程机制结合起来使用才能发挥它真正的作用。本文举两个小例子来说明一下socketpair的基本用法。

TECH_PRO的博客 3969

廖雪峰Python教程[完整版]

廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白

Unix/Linux编程:socketpair

类似域名映射到点位十进制标记一台主机,我们也可以将一个别名映射到一个端口标记一个服务。这个名字到端口的映射通常保存在/etc/service中。(如果端口号改变,我们所需做的所有改动就是改动文件/etc/services中的一行,而不是重新编译应用程序) 理论 #include <netdb.h> /* * 功能: * 参数:name: 一个指向服务名的指针。 * proto: 指向协议名的指针(可选)。如果这个指针为空,getservbyname()返回第一个name与s_na.

OceanStar的博客 427

深度解析 Linux 中的 socketpair 函数

socketpair 函数为本地进程(或线程)间通信提供了一条“全双工、可靠、易用”的通道,其核心价值可以用一张流程图概括:fill:#333;color:#333;color:#333;fill:none;创建两个相互连接的套接字sv[0]和sv[1]进程/线程间共享或传递套接字描述符通过sv[0]和sv[1]进行双向通信特点:全双工、可靠(SOCK_STREAM)、本地高效适用场景:父子进程、兄弟进程、线程间数据交换。

weixin_42108533的博客 519

Linux下socketpair使用总结

1.socketpair函数: #include <sys/types.h> #include <sys/socket.h> int socketpair(int d, int type, int protocol, int sv[2]); socketpair函数创建一对无名的相互连接的套接字。 返回值:成功返回0,创建好的套接字分别为sv[1]和sv[2];否...

paradox_1_0的博客 489

linux 本地通信 socketpair 的使用

linux 本地通信 socketpair 的使用 linux 下本地通信的方式有多种,此次介绍socketpair的使用。 函数原型: NAME socketpair - create a pair of connected sockets SYNOPSIS #include &amp;lt;sys/socket.h&amp;gt; int socketpair(int domain, i...

烟雨朦胧的博客 443

socketpair 双向管道

2004 年 9 月 01 日本文阐述了一个使用 socketpair 系统调用在 Linux 上实现双向进程通讯管道的方法,并提供了一个实现。问题和常见方法Linux 提供了 popen 和 pclose 函数 (1),用于创建和关闭管道与另外一个进程进行通信。其接口如下:FILE *popen(const char *command, const char

狂飙的蜗牛 2402

函数socketpair的用法

socketpair()是Linux/Unix系统中用于创建一对相互连接的匿名套接字的系统调用,主要用于进程间通信(IPC)。

zhaominyong的专栏 625
上一篇: 对vbox中的snapshot原理的理解
下一篇: Linux Socket编程(不限Linux)
YasinLeeX
博客等级 码龄19年 380粉丝 310原创
评论 4
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

YasinLeeX

再来一杯西湖龙井。

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值