8

I've one serial device on 192.168.x.x:yyyy (where "x" and "y" are real number) and it works correctly. But I want to communicate with this as /dev/ttyX device.

I've tested socat command but not working correctly

$ while true; do
    socat pty,link=/dev/ttyX,raw,echo=0,waitslave tcp:192.168.x.x:yyyy; 
done

How can I resolve?

update

  • I think that I must be creating a virtual serial device. VIRTUAL SERIAL DEVICE <-> SERIAL-MACHINE-IP:PORT
  • Do you mean /dev/ttySx? – Hauke Laging May 4 '14 at 10:25
  • yes, in general I want to use remote serial over TCP-IP as classic Serial Device Path such as /dev/tty.... but I don't know how I can. – Domenico M. May 4 '14 at 10:30
  • I think that I must be create virtual serial device. – Domenico M. May 4 '14 at 10:42
  • 1
    Please don't change the subject to RESOLVED, revert this Q to just a Q and add an answer if you've solved it yourself. That's completely fine to answer your own Q. – slm May 4 '14 at 13:18
4

This solved the problem:

$ socat -d -d pty,link=/dev/CUSTOMNAME,raw,echo=0,waitslave tcp:192.168.x.x:yyyy;
| improve this answer | |
  • 1
    What is the proper way to create /dev/CUSTOMNAME? I get socat[12316] E symlink("/dev/pts/5", "/dev/MYDEVICE"): Permission denied when trying to do sudo socat TCP4-LISTEN:9000,reuseaddr,fork,su=nobody PTY,link=/dev/MYDEVICE,raw,echo=0,waitslave – jacobq Aug 14 '17 at 13:19
  • Nevermind; I think the su=nobody was the problem. When I removed that it worked. – jacobq Aug 14 '17 at 13:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.