Interprocess communication using named pipes in C # + PHP

Interprocess communication using Named Pipes in C # is simple, but I don’t know exactly how to do this in php, or if it is possible. so I have the following questions:

  • Are named pipes possible in php?
  • Is it possible to have a C # client named pipe, connect to a php name server named pipe?
  • how would i encode this? :)

the answer to any of the above questions will be , therefore useful .. thanks :)

change . This is a standalone php program, not a web application.

edit2: The named pipe server can be on the C # side or on the PHP side, it does not matter. I made C # examples for both. But I don't know where to start for php

+4
source share
2 answers

Can you use sockets? Why should it be a pipe?

It looks like PHP has a lot for sockets: http://us3.php.net/sockets

Stream Functions:
http://php.net/manual/en/ref.stream.php

Did you see that?
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

EDIT I assume you are on windows (C #), so this might not work.

+2
source

If it is already created, you can open the named pipe as a file using the PHP function fopen.

"" "\\.\pipe\pipe_name", PHP, . :

$name = php_uname('n');
$pipe = fopen("\\\\" . $strComputername . "\\pipe\\pipe_name", "r+");

, , , - , .

+4

All Articles