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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-10 12:13:34  来源:igfitidea点击:

Client-Server in c#

c#clientclient-server

提问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 :

尝试这个 :

  1. Introduction to TCP client server in C#

  2. Simple-Client-server-Interactions-using-C#

  1. C#中TCP客户端服务器介绍

  2. Simple-Client-server-Interactions-using-C#