gpt4 book ai didi

tcp - 当端口连接到时启动进程

转载 作者:可可西里 更新时间:2023-11-01 02:53:02 25 4
gpt4 key购买 nike

我想创建一个单一的客户端,它从同一 LAN 上的许多工作站中的任何一个发出单播数据请求。客户端可能会运行 Linux,但工作站可能会运行任何操作系统。是否可以避免在每个工作站上运行守护进程,而让它们在几秒钟内回复请求?我想避免创建守护进程,因为该服务可能不常使用,而且我不想让另一个进程给工作站增加负担。

最佳答案

看看 inetd 的合适实现为您的目标操作系统。此服务监听连接,并通过标准输入/标准输出将实际通信委托(delegate)给普通 IO 到您的进程实例(按需生成):

The inetd utility [..] listens for connections on certain internet sockets. When a connection is found on one of its sockets, it decides what service the socket corresponds to, and invokes a program to service the request. The server program is invoked with the service socket as its standard input, output and error descriptors. After the program is finished, inetd continues to listen on the socket [..]

关于tcp - 当端口连接到时启动进程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3857469/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com