The purpose of this sample is to demonstrate how to listen for the socket connection request and how to collect and display data produced by QuickBuild.
QuickBuild can be either client or server, and this sample expects QuickBuild to be client as the sample creates a server socket.
此示例的目的是演示如何监听套接字连接请求以及如何收集和显示 QuickBuild 生成的数据。
QuickBuild 可以是客户端或服务器,并且此示例希望 QuickBuild 成为客户端,因为该示例创建了一个服务器套接字。
As soon as the socket connection is made, the sample launches a thread whose responsibility is to start collecting and displaying data.
一旦建立了套接字连接,示例就会启动一个线程,该线程负责开始收集和显示数据。
.NET provides two classes that assist socket communications–TCPListener and TCPClient. The TcpListener class provides simple methods that listen for and accept incoming connection requests in blocking synchronous mode. The TcpClient class provides simple methods for connecting, and receiving stream data over a network in synchronous blocking mode. This sample program only deals with synchronous blocking mode.
.NET 提供了两个辅助套接字通信的类——TCPListener 和 TCPClient。 TcpListener 类提供了以阻塞同步模式侦听和接受传入连接请求的简单方法。 TcpClient 类提供了以同步阻塞模式通过网络连接和接收流数据的简单方法。 本示例程序只处理同步阻塞模式。
This program launches a thread when the user presses the Listen button. This thread’s responsibility is to look for all the clients that wish to communicate with this sample application. When the user decides to stop listening,the sample closes all client connections, and terminate the thread.
当用户按下 Listen 按钮时,该程序启动一个线程。 该线程的职责是查找所有希望与该示例应用程序通信的客户端。 当用户决定停止监听时,示例关闭所有客户端连接,并终止线程。
Note: This program’s focus is not showing how to write a multi-threaded application, but simply how to listen for the socket connection request and collect and display QuickBuild data.
注意:本程序的重点不在于展示如何编写多线程应用程序,而在于如何监听套接字连接请求并收集和显示 QuickBuild 数据。