命名管道的麻烦... [英] Named Pipes troubles...

查看:73
本文介绍了命名管道的麻烦...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所有问候!需要帮助...:confused:

有一个名为"蝙蝠!"的命名管道进程.
问题:如何正确通过. NET Framwork,在线程中发送一些文本,这些文本将成为指定进程的命令?
我尝试过这种方式:

All greetings! Need help ...:confused:

There is a Named Pipe process called "The Bat!"
Question: How correctly through. NET Framwork, send in the thread some text that will be the command for the specified process?
I tried this way:

using System.IO.Pipes;
...

string mail = "/MAIL USER=MailBox;TO=box@yahoo.com;SEND";
byte[] buff = new byte[mail.Length];

for (int i = 0; i < mail.Length; i++ )
{
 buff[i] = Convert.ToByte(mail[i]);
}

NamedPipeClientStream pipe = new NamedPipeClientStream("The Bat!");
 pipe.Connect();
  pipe.Write(buff, 0, buff.Length);
 pipe.Flush();
 pipe.Close();
...


在结果页面中不需要... :(


In result page is not request... :(

Thanks in advance!

推荐答案

可以从接收方发布代码吗?

查看此更改是否有帮助:

Can you post the code from the receiver?

See if this change helps:

using System.IO.Pipes;
...
string mail = "/MAIL USER=MailBox;TO=box@yahoo.com;SEND";

System.Text.Encoding enc = System.Text.Encoding.ASCII;
byte[] buff = enc.GetBytes(mail);

NamedPipeClientStream pipe = new NamedPipeClientStream("The Bat!"); pipe.Connect();  
pipe.Write(buff, 0, buff.Length); 
pipe.Flush(); 
pipe.Close();
...


这篇关于命名管道的麻烦...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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