protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
SocketServer socket = new SocketServer(1234, "192.168.88.196", TextBox1);
//启动线程
Thread thread = new Thread(new ThreadStart(socket.beginListen));
thread.Start();
// 在应用程序启动时运行的代码
//(new System.Threading.Thread(new System.Threading.ThreadStart(new Class1().CreatSocket))).Start();//开辟一个新线程
}
}开辟一个新线程Thread
最新推荐文章于 2023-06-20 09:48:03 发布
本文介绍了一个简单的Socket服务器的初始化与线程管理过程。该服务器通过指定端口和IP地址进行监听,并在应用程序启动时创建一个新的线程来处理连接请求。
255

被折叠的 条评论
为什么被折叠?



