0
votes

I have this serial port Sensor I would like to connect to via TCP . can anyone share socat setup for this kind of connection?

my serial port needs:

  • USB -> /dev/ttyUSB0
  • BAUDRATE 9600
  • DATABITS 8
  • STOPBITS 1
  • PARITY 0 /NONE

I can read and write to the posrt using minicom but I would like to automate this using java so I need an TCP client for the task to work.

Be able to write and read results form the port.

Thanks.

here is an example that doesnt work:

socat -d -d -d -d -x TCP-LISTEN:7757,reuseaddr,fork FILE:/dev/ttyUSB0,b9600,raw
1
why do you say it does not work ?user803422
If you look at my answer below you see I was missing some options. This is for a very specific sensor type. Are you using the same sensor?Gadi

1 Answers

0
votes

here is my bash script for debug

#!/bin/bash
# socat start script

socat -d -d -d -d tcp-listen:4141,reuseaddr,fork file:/dev/ttyUSB0,nonblock,cs8,b9600,cstopb=0,raw,echo=0

Remove the '-d' to remove debug

This fits a specific type of sensors connected via USB