Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用一个在数百个 GPRS 设备中使用的应用程序,服务器与客户端连接并每 1 或 2 分钟接收一个信息包。当接收到数据包时,服务器会发送一个确认数据包。这是我的问题:
1 - Indy 服务器自动为每个连接启动一个线程?如果是这样,我该如何管理这些线程。2-如何为每个输出包创建一个线程?因为 GPRS 设备响应缓慢。
谢天谢地,保罗·塞拉斯
是的,IndyTIdTCPServer为每个客户端连接创建一个单独的线程。你不需要做任何事情来管理这种行为,它是自动的。您可以在 Indy 之外创建自己的工作线程,只需使用 VCL 的TThread类,或 Indy 的TIdThread或 TIdThreadComponent` 组件。但在这种情况下,我认为没有必要,您不需要使用额外的线程将数据包发送回设备。
TIdTCPServer
TThread
TIdThread