Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

can socat exec a program just once when accepting a connection?

I am trying to invoke a command (mysql CLI) when I connect to a certain port. This works just fine, except that every time I connect, a new instance of the command is invoked. Tried to use the end-close option but mysql CLI is killed when I close the connection, and a new one is fired when I reconnect. Command line used is below. Any way to have socat launching the mysql command once, and just reuse that process when new connections arrive? Thanks in advance!

socat TCP4-LISTEN:$port,reuseaddr,fork,bind=127.0.0.1,linger=3600 EXEC:"mysql -ANnvvf -u $user -h $host $passstr $portstr $socketstr",end-close
question from:https://stackoverflow.com/questions/65943376/can-socat-exec-a-program-just-once-when-accepting-a-connection

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...