using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Net.Sockets; using System.Net; using System.Threading; namespace ConsoleApplication2 { public class StateObject { public Socket newsocket = null; ; pub
异步服务器套接字示例 From https://msdn.microsoft.com/zh-cn/library/fx6588te(v=vs.110).aspx 下面的示例程序创建接收来自客户端的连接请求的服务器. 服务器以异步套接字生成,因此,服务器应用程序的执行不会挂起,它在等待从客户端时的连接. 应用程序收到来自客户端的字符串,在控制台上显示字符串,然后回显该字符串返回给客户端. 从客户端的字符串必须包含字符串""用于通知消息的结尾. C# using System; using