我如何在守护进程之后进行清理?
我正在使用修改后的版本运行 HTTP::Daemon 的本地实例文档中概述的循环结构。我已经可以根据用户的请求退出循环,但随后执行 Perl 脚本会出现错误:
HTTP::Daemon:地址已在使用中...在 /path/to/script 行 NNN 第 3 行传播。
为了成为一个好公民并在我的守护进程之后进行清理,我还需要做什么?
I am running a local instance of HTTP::Daemon using a modified version of the looping structure outlined in the documentation. I have made it possible to exit the loop at the user's request, but a subsequent execution of my Perl script gives me the error:
HTTP::Daemon: Address already in use ...propagated at /path/to/script line NNN, line 3.
What more must I do to be a good citizen and clean up after my Daemon?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
很可能什么也没有。该地址正由前一个实例的剩余连接使用。一旦全部关闭,地址就会自动释放。
如果你想加速这个过程,你可以在绑定之前设置 SO_REUSEADDR 套接字选项。有关更多详细信息,请参阅 PERL 套接字 文档。 “如果服务器在没有未完成连接的情况下死亡,则端口将不会立即重用,除非您使用setsockopt()函数使用选项SO_REUSEADDR。”
Most likely nothing. The address is in use by leftover connections from the previous instance. As soon as they are all shut down, the address will be automatically released.
If you want to speed up this process, you can set the SO_REUSEADDR socket option before binding. See the PERL socket documentation for more details. "if a server dies without outstanding connections the port won't be immediately reusable unless you use the option SO_REUSEADDR using setsockopt() function."