大网数据广告活动
服务器运维问答

Always keep socat alive

· 52CE 我爱测

I have a socat running nicely, executing my command when a connection comes in with the arguments provided. However, the issue I am having is that the socket is at EOF and the next time a connection comes in, the process takes 3 …

问题原文

原帖链接 · Robbie Trencheny · CC BY-SA 3.0

I have a socat running nicely, executing my command when a connection comes in with the arguments provided. However, the issue I am having is that the socket is at EOF and the next time a connection comes in, the process takes 3 seconds to spin back up. The process will stay up forever, so it's socat thinking there is an EOF, at least that is my understanding.

My command is: socat -v -s -d -d tcp-listen:2600,reuseaddr,fork exec:"/usr/bin/cec-client $CEC_CLIENT_ARGS"

Relevant log lines:

2014/12/31 22:41:04 socat[4746] N socket 1 (fd 4) is at EOF
2014/12/31 22:41:05 socat[4746] N exiting with status 0

I have tried ignoreeof on both ends, to no effect. I have also tried setting timeouts, both -t and -T

已采纳解答

原帖链接 · jtpereyda · CC BY-SA 4.0

If you're using a LISTEN command like OPENSSL-LISTEN, TCP-LISTEN, etc., the fork option will spin off connections to a child process so that socat can continue receiving.

Example:

socat - OPENSSL-LISTEN:443,method=TLS1.2,verify=0,cert=cert.pem,key=key.pem,fork

Thanks to: https://unix.stackexchange.com/a/283289/15954

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2015-01-01)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0 / CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。