局域网进程通信#c [英] lan process communication #c‬

查看:109
本文介绍了局域网进程通信#c的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



实现局域网进程间通信的最简单方法是什么?
我需要阻止机器A上的进程,直到机器B上的进程向他发送一个简单的字符串msg

现在就不值得建设整个WCF项目吗?

您怎么说?

Hi,

What''s the easiest way to implement lan interprocess communication ?
I need process on machine A be blocked until process on machine B send him just a simple string msg

Don''t now if it worth building a whole WCF project

What Do you say?

推荐答案

好吧,您当然可以在udp端口上侦听,并直接处理消息.
事情是当您开始执行此操作时,您将不得不处理打开端口的所有细节,检查防火墙,检查安全性,检查客户端是否可以执行此操作,等等.
WCF为您处理所有这一切.如果您自己执行此操作,则可能会创建漏洞并在程序中引入未处理的条件.
Well, you could of course listen on a udp port, and handle the message directly.
The things is when you start doing this, you''ll have to handle all the nitty-gritty of opening ports, checking the firewall, checking security, checking if the client can do this operation, etc...
WCF handles all this for you. If you do it yourself, you run the chance of creating vulnerabilities and introduce unhandled conditions in your program.


这里是使用C#的一个很好的示例.它的功能远远超出您的要求,但我敢肯定您可以放大相关的信息...
http://msdn.microsoft.com/en-us/magazine/cc163648.aspx [ ^ ]

选择端口由您决定.不要使用低于1023的任何东西,因为它们已预先分配给服务.您应该将端口配置为可配置的,因为其他人可能选择了相同的端口,并且会遇到冲突.

最佳做法是获得高于6000的分数.
Here''s a good example using C#. It does a lot more than what you ask for, but I''m sure you can zoom in on the relevant bits...
http://msdn.microsoft.com/en-us/magazine/cc163648.aspx[^]

Choosing the port is up to you. Don''t use anything below 1023, because they''re pre-assigned to services. You should make your port configurable, because someone else may have chosen the same port, and you''ll run into a conflict.

Best practice is to get something above 6000.


这篇关于局域网进程通信#c的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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