Last Modified: 2025-04-13 08:04:00Z
Table of Contents
Socat, short of SOcket CAT, is a multi-purpose relay program. It establishes two bidirectional connections and transfers data between them.
1. Build
Visit http://www.dest-unreach.org/socat/, and download the recent version of socket. Then unpack the .tar.gz
file.
$ cd ~/Downloads
$ $ tar -xvzf socat-1.8.0.3.tar.gz
socat-1.8.0.3/
socat-1.8.0.3/xio-rawip.c
socat-1.8.0.3/proxy.sh
socat-1.8.0.3/filan_main.c
socat-1.8.0.3/dalan.h
socat-1.8.0.3/xio-termios.h
...
Enter the socat-<version>
directory. And run ./configure
command.
$ ./configure
checking which defines needed for makedepend...
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
...
If there were no error, run make
command to build the socat
.
$ make
gcc -O -D_GNU_SOURCE -Wall -Wno-parentheses -DHAVE_CONFIG_H -I. -I. -c -o socat.o socat.c
gcc -O -D_GNU_SOURCE -Wall -Wno-parentheses -DHAVE_CONFIG_H -I. -I. -c -o xioinitialize.o xioinitialize.c
gcc -O -D_GNU_SOURCE -Wall -Wno-parentheses -DHAVE_CONFIG_H -I. -I. -c -o xiohelp.o xiohelp.c
gcc -O -D_GNU_SOURCE -Wall -Wno-parentheses -DHAVE_CONFIG_H -I. -I. -c -o xioparam.o xioparam.c
gcc -O -D_GNU_SOURCE -Wall -Wno-parentheses -DHAVE_CONFIG_H -I. -I. -c -o xiodiag.o xiodiag.c
gcc -O -D_GNU_SOURCE -Wall -Wno-parentheses -DHAVE_CONFIG_H -I. -I. -c -o xioopen.o xioopen.c
gcc -O -D_GNU_SOURCE -Wall -Wno-parentheses -DHAVE_CONFIG_H -I. -I. -c -o xioopts.o xioopts.c
...
$ file socat
socat: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=2dcdd0102ba0b5dd664b1dbf49ccf22c3510802e, for GNU/Linux 3.2.0, not stripped
3. Reference
-
Homepage: http://www.dest-unreach.org/socat/
-
Linux man pages socat(1)