使用C#+ PHP命名管道进程间通信 [英] Interprocess Communication using Named Pipes in C# + PHP

查看:210
本文介绍了使用C#+ PHP命名管道进程间通信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用命名管道在C#进程间通信是容易的,但林不完全知道如何在PHP中做到这一点,或者如果它甚至有可能。所以我有这些问题:

Interprocess Communication using Named Pipes in C# is easy, but im not exactly sure how to do this in php, or if its even possible. so i have these questions:


  1. 被命名为PHP的管道可能

  2. 是否有可能有一个名为管道客户一个C#,连接命名管道服务器PHP?

  3. 到底如何我的代码? :)

回答任何上述问题将所以有帮助..谢谢:)

an answer to any of the above questions would be so helpful.. thanks :)

编辑:它是一个独立的PHP程序,而不是基于Web的应用程序

edit: Its a stand alone php program, not a web-based app.

EDIT2:的命名管道服务器,可以在C#的一面,或PHP方面,它不事关。我做了C#示例都..但我不知道从哪里开始的PHP

edit2: The named pipe server can be in the C# side, or the PHP side, it doesnt matter. I have made C# examples for both.. but i dont know where to start for php

推荐答案

你能使用套接字?为什么一定要管?

Can you use sockets? Why does it have to be a pipe?

看起来像PHP有很多的插座:
http://us3.php.net/sockets

Looks like PHP has lots for sockets: http://us3.php.net/sockets

流函数:结果
http://php.net/manual/en/ref.stream.php

你有没有看到这个结果
PHP和命名管道:的 http://my.opera.com/zomg/blog/2007/08/29/php-and-named-pipes

Did you see this?
PHP and named pipes: http://my.opera.com/zomg/blog/2007/08/29/php-and-named-pipes

<?php
//Open pipe and write some text to it.
//Mode must be r+ or fopen will get stuck.
$pipe = fopen('testpipe','r+');
fwrite($pipe,'this is some text');
fclose($pipe);
?>



posix_mkfifo:结果
http://www.phpbuilder.com/manual/function.posix-mkfifo.php

修改我假设你使用的是Windows(C#),因此可能无法正常工作......

EDIT I am assuming you are on windows (C#) so that may not work....

这篇关于使用C#+ PHP命名管道进程间通信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆