Skip to content

Instantly share code, notes, and snippets.

@deadprogram
Last active December 12, 2015 09:19
Show Gist options
  • Select an option

  • Save deadprogram/4750389 to your computer and use it in GitHub Desktop.

Select an option

Save deadprogram/4750389 to your computer and use it in GitHub Desktop.
$ socat -d -d -d TCP-LISTEN:4567,fork /dev/tty.usbserial-A700636n,nonblock,raw,b9600
2013/02/10 09:55:51 socat[9197] I socat by Gerhard Rieger - see www.dest-unreach.org
2013/02/10 09:55:51 socat[9197] I This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit. (http://www.openssl.org/)
2013/02/10 09:55:51 socat[9197] I This product includes software written by Tim Hudson (tjh@cryptsoft.com)
2013/02/10 09:55:51 socat[9197] I setting option "fork" to 1
2013/02/10 09:55:51 socat[9197] I socket(2, 1, 6) -> 3
2013/02/10 09:55:51 socat[9197] I starting accept loop
2013/02/10 09:55:51 socat[9197] N listening on LEN=16 AF=2 0.0.0.0:4567
2013/02/10 09:55:55 socat[9197] I accept(3, {2, LEN=16 AF=2 127.0.0.1:60910}, 16) -> 4
2013/02/10 09:55:55 socat[9197] N accepting connection from LEN=16 AF=2 127.0.0.1:60910 on LEN=16 AF=2 127.0.0.1:4567
2013/02/10 09:55:55 socat[9197] I permitting connection from LEN=16 AF=2 127.0.0.1:60910
2013/02/10 09:55:55 socat[9197] N forked off child process 9200
2013/02/10 09:55:55 socat[9197] I close(4)
2013/02/10 09:55:55 socat[9197] I still listening
2013/02/10 09:55:55 socat[9197] N listening on LEN=16 AF=2 0.0.0.0:4567
2013/02/10 09:55:55 socat[9200] I just born: child process 9200
2013/02/10 09:55:55 socat[9200] I just born: child process 9200
2013/02/10 09:55:55 socat[9200] I close(3)
2013/02/10 09:55:55 socat[9200] I interpreting address "/dev/tty.usbserial-A700636n" as file name
2013/02/10 09:55:55 socat[9200] I setting option "o-nonblock" to 1
2013/02/10 09:55:55 socat[9200] I setting option "raw"
2013/02/10 09:55:55 socat[9200] E parseopts(): unknown option "b9600"
2013/02/10 09:55:55 socat[9200] N exit(1)
2013/02/10 09:55:55 socat[9200] I shutdown(4, 2)
2013/02/10 09:55:55 socat[9197] I childdied(signum=20)
2013/02/10 09:55:55 socat[9197] I childdied(20): cannot identify child 9200
2013/02/10 09:55:55 socat[9197] W waitpid(): child 9200 exited with status 1
2013/02/10 09:55:55 socat[9197] I waitpid(-1, {}, WNOHANG): No child processes
2013/02/10 09:55:55 socat[9197] I childdied() finished
^C2013/02/10 09:56:15 socat[9197] N exiting on signal 2
2013/02/10 09:56:15 socat[9197] I shutdown(3, 2)
2013/02/10 09:56:15 socat[9197] I shutdown(3, 2): Socket is not connected
$ socat -d -d -d TCP-LISTEN:4567,fork /dev/tty.usbserial-A700636n,nonblock,raw,ispeed=9600,ospeed=9600
2013/02/10 09:56:48 socat[9202] I socat by Gerhard Rieger - see www.dest-unreach.org
2013/02/10 09:56:48 socat[9202] I This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit. (http://www.openssl.org/)
2013/02/10 09:56:48 socat[9202] I This product includes software written by Tim Hudson (tjh@cryptsoft.com)
2013/02/10 09:56:48 socat[9202] I setting option "fork" to 1
2013/02/10 09:56:48 socat[9202] I socket(2, 1, 6) -> 3
2013/02/10 09:56:48 socat[9202] I starting accept loop
2013/02/10 09:56:48 socat[9202] N listening on LEN=16 AF=2 0.0.0.0:4567
2013/02/10 09:56:53 socat[9202] I accept(3, {2, LEN=16 AF=2 127.0.0.1:60914}, 16) -> 4
2013/02/10 09:56:53 socat[9202] N accepting connection from LEN=16 AF=2 127.0.0.1:60914 on LEN=16 AF=2 127.0.0.1:4567
2013/02/10 09:56:53 socat[9202] I permitting connection from LEN=16 AF=2 127.0.0.1:60914
2013/02/10 09:56:53 socat[9202] N forked off child process 9205
2013/02/10 09:56:53 socat[9202] I close(4)
2013/02/10 09:56:53 socat[9202] I still listening
2013/02/10 09:56:53 socat[9202] N listening on LEN=16 AF=2 0.0.0.0:4567
2013/02/10 09:56:53 socat[9205] I just born: child process 9205
2013/02/10 09:56:53 socat[9205] I just born: child process 9205
2013/02/10 09:56:53 socat[9205] I close(3)
2013/02/10 09:56:53 socat[9205] I interpreting address "/dev/tty.usbserial-A700636n" as file name
2013/02/10 09:56:53 socat[9205] I setting option "o-nonblock" to 1
2013/02/10 09:56:53 socat[9205] I setting option "raw"
2013/02/10 09:56:53 socat[9205] I setting option "ispeed" to 9600
2013/02/10 09:56:53 socat[9205] I setting option "ospeed" to 9600
2013/02/10 09:56:53 socat[9205] I "/dev/tty.usbserial-A700636n" is not a socket, open()'ing it
2013/02/10 09:56:53 socat[9205] N opening character device "/dev/tty.usbserial-A700636n" for reading and writing
2013/02/10 09:56:53 socat[9205] I open("/dev/tty.usbserial-A700636n", 016, 0666) -> 3
2013/02/10 09:56:53 socat[9205] I resolved and opened all sock addresses
2013/02/10 09:56:53 socat[9205] N starting data transfer loop with FDs [4,4] and [3,3]
2013/02/10 09:57:00 socat[9205] I transferred 9 bytes from 3 to 4
2013/02/10 09:57:00 socat[9205] I transferred 15 bytes from 3 to 4
2013/02/10 09:57:00 socat[9205] I transferred 16 bytes from 3 to 4
2013/02/10 09:57:00 socat[9205] I transferred 15 bytes from 3 to 4
2013/02/10 09:57:00 socat[9205] I transferred 3 bytes from 3 to 4
^C2013/02/10 09:57:37 socat[9202] N exiting on signal 2
2013/02/10 09:57:37 socat[9202] I shutdown(3, 2)
2013/02/10 09:57:37 socat[9205] N exiting on signal 2
2013/02/10 09:57:37 socat[9205] I shutdown(4, 2)
2013/02/10 09:57:37 socat[9202] I shutdown(3, 2): Socket is not connected
2013/02/10 09:57:37 socat[9205] I shutdown(4, 2): Socket is not connected
@deadprogram

Copy link
Copy Markdown
Author

The output labeled b9600 returns 'unknown option' for b9600 param. The output labeled 'ispeed-ospeed' takes the 'ispeed' and 'ospeed' options, but does not appear to actually be using that baud rate to communicate, which I can tell from receiving incorrect data bytes back from within the calling app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment