I'm trying to run socat forward ttyACM0 into UDP. It works with command.
socat UDP-LISTEN:14550,fork,reuseaddr FILE:/dev/ttyACM0,b57600,raw
Problem is, I need to access socat via ip address, which is inside netns. I tried to enter this command:
ip netns exec int socat UDP-LISTEN:14550,fork,reuseaddr FILE:/dev/ttyACM0,b57600,raw
, which displays error:
2024/10/10 14:14:37 socat[6255] E read(5, 0x1d54000, 8192): Connection refused
2024/10/10 14:14:38 socat[6259] E read(5, 0x1d54000, 8192): Connection refused
2024/10/10 14:14:39 socat[6263] E read(5, 0x1d54000, 8192): Connection refused
2024/10/10 14:14:40 socat[6267] E read(5, 0x1d54000, 8192): Connection refused
2024/10/10 14:14:41 socat[6268] E read(5, 0x1d54000, 8192): Connection refused
2024/10/10 14:14:42 socat[6272] E read(5, 0x1d54000, 8192): Connection refused
2024/10/10 14:14:43 socat[6276] E read(5, 0x1d54000, 8192): Connection refused
2024/10/10 14:14:44 socat[6280] E write(5, 0x1d54000, 44): Connection refused
2024/10/10 14:14:45 socat[6284] E read(5, 0x1d54000, 8192): Connection refused
2024/10/10 14:14:46 socat[6288] E read(5, 0x1d54000, 8192): Connection refused
2024/10/10 14:14:47 socat[6292] E read(5, 0x1d54000, 8192): Connection refused
2024/10/10 14:14:48 socat[6296] E write(5, 0x1d54000, 40): Connection refused
2024/10/10 14:14:49 socat[6300] E read(5, 0x1d54000, 8192): Connection refused
2024/10/10 14:14:50 socat[6304] E read(5, 0x1d54000, 8192): Connection refused
How to properly run socat inside netns?
/dev/ttyACM0? What's open of fd 5 (lsof should tell you)? Have you tried passing a few-doptions tosocatto have more information on how the plumbing is done?/dev/ttyACM0is replying (or it's just the local echo as you didn't add aecho=0on the second address) to whatever message is received over UDP, but that response is rejected because the sender's socket has already been torn down.