Raspberry PI-> C与点网核心进程之间的通信

问题描述

我想在树莓派设备上的两个进程之间建立通信。一种过程用C语言编写,另一种过程用dot net core

借助以下示例,我能够创建一个命名管道并从该管道读取

#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>


/*https://raspBerry-projects.com/pi/programming-in-c/pipes/named-pipes-fifos*/

#define OUR_INPUT_FIFO_NAME "/tmp/my_fifo"
int main()
{
    printf("Hello World!");

    int result;
    int fs = -1;

    result = mkfifo(OUR_INPUT_FIFO_NAME,0777);

    if ( result == 0 )
    {
        printf("New FIFO,%s created successfully",OUR_INPUT_FIFO_NAME);
    }

    fs = open(OUR_INPUT_FIFO_NAME,(O_RDONLY | O_NONBLOCK));

    if ( fs != -1 ) 
    {
        printf("Successfully opend %s",OUR_INPUT_FIFO_NAME);
    }

    while(1)
    {
        unsigned char buffer[256];
        memset(buffer,sizeof(buffer));
        int len = read(fs,(void *)buffer,sizeof(buffer));

        if ( len == 0 ) 
        {
            printf("Sleeping \r\n");
            sleep(1);
        }
        else
        {
            printf("Data received : %s \r\n",buffer);
        }
    }

    return 0;
}

现在,我正试图为.net core application进程通过/tmp/my_fifo进程通过命名管道(C)接收消息的方法

我在.net核心中的NamedPipeServerStreame上找到了一些文档,但是我想我们必须在.net核心中同时拥有客户端和服务器。

有指针吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...