[英]C# - Using WCF for a local network client/server software
I'm working on this project where I have 7 PCs connected to a switch, one of them is the server. 我正在这个项目中,我有7台PC连接到交换机,其中一台是服务器。
The clients wont send/receive data between each other, they will only send some "characters/strings" to the server. 客户端之间不会相互发送/接收数据,它们只会向服务器发送一些“字符/字符串”。 Also, the server will send "characters/strings" to the clients. 同样,服务器将“字符/字符串”发送给客户端。 Also, I need to know on the server software if the clients are connected normally. 另外,我需要在服务器软件上知道客户端是否正常连接。
So I read that using WCF is the best way of doing this program. 因此,我读到使用WCF是执行此程序的最佳方法。 Also, I guess it can work normally using TcpClient
in C#. 另外,我猜它可以在C#中使用TcpClient
正常工作。
So what's the best way for dealing with such case? 那么处理这种情况的最佳方法是什么? Any good tutorials or example that can be of help? 有什么好的教程或示例可以提供帮助吗?
Thanks. 谢谢。
WCF is a good solution and allows an easy way for enrich the comunication in the future. WCF是一个很好的解决方案,并为将来丰富通信提供了简便的方法。 You can host the service in any .net project (console application, web prohect, windows forms or wpf). 您可以在任何.net项目(控制台应用程序,Web Prohect,Windows窗体或wpf)中托管服务。 Adding the reference via Visual Studio and use the proxy is straightful and you won't need the TcpClient (actually I don't think it would work). 通过Visual Studio添加引用并使用代理很简单,并且您不需要TcpClient(实际上我认为它不会起作用)。
Your needs seems to be very simple so I suggest you to take a look at the followind web cast: https://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032344313&culture=en-US The first is more than enough. 您的需求似乎非常简单,所以我建议您看一下followind网站上的广播: https : //msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032344313&culture=en-US第一个绰绰有余。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.