问题描述
我正在使用socat命令在嵌入式Linux设备上创建tty接口,例如:
I am using a socat command to create a tty interface on my embedded linux device like:
socat pty,link=/dev/ttyS9 TCP:10.0.10.1:9999
该连接是一条DSL线上的长距离连接.该线路每天晚上都断开,我的tty界面已关闭.是否可以通过重新连接机制创建tty接口,直到服务器端再次联机?
The connection is a long distance connecstion over a dsl-line. This line is disconnected every night and my tty interface is down. Is it possible to create the tty interace with a mechanism to reconnect until the server side is online again?
下一个问题:是否可以从Java程序中调用socat命令?
Next question: is it possible to call the socat command from a java programm?
非常感谢!卡尔·亨氏
Thanks a lot!Karl-Heinz
推荐答案
从版本V 1.4.0.0开始,socat具有选项重试",永久"和间隔".
As of version V 1.4.0.0 socat features the options "retry", "forever", and "interval".
因此,这应该给您所需的行为:
So, this should give you the desired behavior:
socat pty,link=/dev/ttyS9 tcp:10.0.10.1:9999,forever,interval=10,fork
这篇关于网络故障后重新连接socat连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!