ipc

C# Named Pipes without issuing commands from the Console?

拜拜、爱过 提交于 2020-02-07 05:13:25
问题 I am using Named Pipes to communicate with a process. I have been able to make it work with the following code. (Original code found here : via archive.org ) class ProgramPipeTest { public void ThreadSenderStartClient(object obj) { // Ensure that we only start the client after the server has created the pipe ManualResetEvent SyncClientServer = (ManualResetEvent)obj; using (NamedPipeClientStream pipeStream = new NamedPipeClientStream(".","ToSrvPipe",PipeDirection.Out,PipeOptions.None)) { //

Bad address with mq_open

烂漫一生 提交于 2020-02-06 15:43:12
问题 I am trying to open a simple queue using mq_open but I keep getting error: "Error while opening ... Bad address: Bad address" And I have no idea why. int main(int argc, char **argv) { struct mq_attr attr; //max size of a message attr.mq_msgsize = MSG_SIZE; attr.mq_flags = 0; //maximum of messages on queue attr.mq_maxmsg = 1024 ; dRegister = mq_open("/serverQRegister",O_RDONLY | O_CREAT, S_IRUSR | S_IWUSR,0664, &attr); if(dRegister == -1) { perror("mq_open() failed"); exit(1); } } I updated

C语言 NOTE32

邮差的信 提交于 2020-02-06 00:39:33
系统编程之共享内存 1.创建键值: 头文件: #include <sys/types.h> #include <sys/ipc.h> 函数原型: key_t ftok ( const char * pathname , int proj_id ) ; 参数分析: pathname ---->一般设为当前文件路径"."。 proj_id ---->编号,主要是为了区分不同的键值。 两个进程只要是使用相同的键,那么他们就指向同一个通信模块 使用ipcs -m 查看系统的共享内存: 2.创建共享内存shmid 功能 获取共享内存的 ID 头文件 #include <sys/ipc.h> #include <sys/shm.h> 函数原型 int shmget ( key_t key , size_t size , int shmflg ) ; 参数 分析 key 共享内存的键值 size 共享内存的尺寸(PAGE_SIZE 的整数倍) shmflg 标志位如下 IPC_CREAT 如果 key 对应的共享内存不存在,则创建之 IPC_EXCL 如果该 key 对应的共享内存已存在,则报错 SHM_HUGETLB 使用“大页面”来分配共享内存 SHM_NORESERVE 不在交换分区中为这块共享内存保留空间 mode 共享内存的访问权限(八进制,如 0644) 返回值 成功 该共享内存的

bindService 源码解析(为什么是异步)

此生再无相见时 提交于 2020-02-05 21:51:22
概述 Andromeda 源码解析 (同步获取服务): https://xujiajia.blog.csdn.net/article/details/104166843 前一篇文章分析了Andromeda的源码,其中提到,bindService获取IBinder对象的操作是异步的。 那么为什么会是异步的呢,其中做了哪些操作呢? 在此推荐下看Android源码网站: http://androidxref.com/ (源码较多的文件建议下载后再本地查看,网页上看会比较卡) onServiceConnected的调用栈 首先直接在onServiceConnected中输出一下调用栈。 at com . example . bindservicetest . MainActivity$ 1. onServiceConnected ( MainActivity . java : 29 ) at android . app . LoadedApk$ServiceDispatcher . doConnected ( LoadedApk . java : 1956 ) at android . app . LoadedApk$ServiceDispatcher$RunConnection . run ( LoadedApk . java : 1988 ) at android . os .

Communicate multiple times with a subprocess in Python

时间秒杀一切 提交于 2020-02-05 03:35:30
问题 This question is NOT a duplicate of Communicate multiple times with a process without breaking the pipe? That question is solved because its use case allows inputs to be sent together, but this is not true if your program is interactive (as illustrated in the use case here). Document subprocess.Popen says: communicate(input=None) Interact with process: Send data to stdin. Read data from stdout and stderr, until end-of-file is reached. Wait for process to terminate. ... Is it possible to

Passing values from one Python program to another

不问归期 提交于 2020-02-03 08:07:23
问题 Is it possible -- other than by using something like a .txt/dummy file -- to pass a value from one program to another? I have a program that uses a .txt file to pass a starting value to another program. I update the value in the file in between starting the program each time I run it (ten times, essentially simultaneously). Doing this is fine, but I would like to have the 'child' program report back to the 'mother' program when it is finished, and also report back what files it found to

Passing values from one Python program to another

南笙酒味 提交于 2020-02-03 08:06:27
问题 Is it possible -- other than by using something like a .txt/dummy file -- to pass a value from one program to another? I have a program that uses a .txt file to pass a starting value to another program. I update the value in the file in between starting the program each time I run it (ten times, essentially simultaneously). Doing this is fine, but I would like to have the 'child' program report back to the 'mother' program when it is finished, and also report back what files it found to

Notify/Signal when memory mapped file modified

╄→尐↘猪︶ㄣ 提交于 2020-02-02 00:34:31
问题 I am currently sharing data (<1KB) between multiple processes by memory-mapping. 1 "writer" process and multiple "reader" processes all mmap the same file. Currently the reader processes need to constantly keep checking for updates. The reader processes keep polling the mmap-ed region to see if any new data is written. Typical Usage (and existing implementation) : The "Writer" process is a logger which keeps appending new data (each on a new line) at irregular intervals. At any given point of

Notify/Signal when memory mapped file modified

徘徊边缘 提交于 2020-02-02 00:33:58
问题 I am currently sharing data (<1KB) between multiple processes by memory-mapping. 1 "writer" process and multiple "reader" processes all mmap the same file. Currently the reader processes need to constantly keep checking for updates. The reader processes keep polling the mmap-ed region to see if any new data is written. Typical Usage (and existing implementation) : The "Writer" process is a logger which keeps appending new data (each on a new line) at irregular intervals. At any given point of

AD19的IPC封装向导使用

寵の児 提交于 2020-02-01 02:58:56
  Altium Designer自带的封装向导包含的模型内容很少,并且需要人为计算封装参数。AD19为其添加了一款功能更强的封装向导,IPC封装向导。   首先新建一个pcblib文件。依次单击工具(T)->IPC compliant footprint wizard。出现如下界面:   可见,相比老旧的封装向导,IPC封装向导包含的模型更多了。这里以常见的数字/数模芯片封装SOP-16举例该如何使用IPC封装向导设计一款封装。   点选“SOP/TSOP”后进入上图所示界面。最左边一栏为封装的各种参数,中间一栏是各参数对应的物理长度示意,最右边一栏是目前参数的封装大致示意图,可以点击红框处切换2D/3D显示。   首先参数第一栏“width range”为芯片包含引脚的总长度,也就是中间示意图对应的变量H。   这里从网上找到了一个SOP16标准封装的文档。在文档中可见,芯片总宽度对应的是E。   在文档的数据表里查看“E”对应的数据大小。这里注意一下数据表有三列。第一列是变量名;第二列的毫米为单位的数据;第三列为英尺对应的数据。我们一般使用毫米为单位。在毫米为单位的列中又有MIN NOM MAX三个小列。由于工艺误差的存在,芯片的尺寸不可能是完全一样的。这里的MIN和MAX对应芯片数据的最小值与最大值,而NOM代表标准值。标准值在IPC封装向导里是没用的