C#中的客户端 - 服务器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14545877/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Client-Server in c#
提问by Idanis
I'm looking for a tutorial/example for writing a client application and a server application. I wish to send the server commands to run, and have the server run them.
我正在寻找用于编写客户端应用程序和服务器应用程序的教程/示例。我希望发送服务器命令来运行,并让服务器运行它们。
采纳答案by Gigi
Check out TcpListener(server) and TcpClient(client) on MSDN, examples included.
查看MSDN 上的TcpListener(服务器)和TcpClient(客户端),包括示例。
As for sending commands, you can simple send strings and parse them at the other end. But if you want to go a step further, look up the Command design pattern.
至于发送命令,可以简单的发送字符串,在另一端解析。但是,如果您想更进一步,请查看命令设计模式。
回答by Iswanto San
Google it with keyword : example client server C#
用关键字搜索它:示例客户端服务器 C#
Try this :
尝试这个 :