Socat (SOcket CAT) is a multipurpose relay tool for bidirectional data transfer between two independent data channels. Each channel may be a file, pipe, device (serial line etc. or a pseudo terminal), socket (UNIX, IP4, IP6, raw, UDP, TCP), TLS socket, proxy CONNECT connection, file descriptor (stdin etc.), the GNU line editor (readline), a program, or a combination of two of those. These modes include generation of 'listening' sockets, named pipes, and pseudo terminals. This project aims to simplify the process of building and installing Socat 1.8.1.1 on Windows systems using Cygwin.
-
Download the Cygwin Installer:
- Go to the official Cygwin website: https://www.cygwin.com/
- Download the appropriate installer (
setup-x86_64.exefor a 64-bit architecture).
-
Run the Cygwin Installer:
- Execute
setup-x86_64.exe. - Choose an installation directory (e.g.,
C:\cygwin64). - Select a package cache directory (e.g.,
C:\cygwin64\packages).
- Execute
-
Select Necessary Packages:
- When you reach the screen where you can select packages to install, search for and install the following packages:
- gcc-core: For C compilation.
- make: To manage build scripts.
- automake: To generate configuration files.
- autoconf: To configure sources.
- libtool: For shared library management.
- openssl-devel: For SSL/TLS support.
You can use the search bar to find these packages more easily.
- When you reach the screen where you can select packages to install, search for and install the following packages:
-
Complete the Installation:
- Continue with the installation by following the instructions.
-
Open a Cygwin terminal:
- You can find a shortcut in the Start menu or run
C:\cygwin64\Cygwin.bat.
- You can find a shortcut in the Start menu or run
-
Download the socat source code (version 1.8.1.1):
wget http://www.dest-unreach.org/socat/download/socat-1.8.1.1.tar.gz
-
Extract the source code:
tar -xzf socat-1.8.1.1.tar.gz cd socat-1.8.1.1
-
Prepare the sources for compilation:
./configure
If you encounter errors related to OpenSSL, ensure that
openssl-develis installed via Cygwin. -
Compile socat:
make
-
Verify the compilation:
- Once the compilation is complete, you should have an executable
socat.exein the current directory (your_current_directory).
- Once the compilation is complete, you should have an executable
-
Copy
socat.exeto an accessible directory from your Windows command line:cp your_current_directory/socat.exe /cygdrive/c/path/to/your/desired/location/
For example, if you want to copy
socat.exetoC:\Program Files\socat, use:cp your_current_directory/socat.exe /cygdrive/c/Program\ Files/socat/ -
Add this directory to the system PATH to be able to use
socatfrom anywhere:- Open Windows Settings.
- Go to System > About > Advanced system settings.
- Click on "Environment Variables".
- In the "System variables" section, find and select the
Pathvariable, then click "Edit". - Click "New" and add the path to the folder containing
socat.exe(e.g.,C:\Program Files\socat). - Click "OK" to close all windows.
Otherwise for the others, there is one ready-made file 'socat-1.8.1.1.rar'. You can download it by going to : socat-1.8.1.1.rar and proceeding by keyboard shortcut (Ctrl + Shift + s).
You now have compiled socat version 1.8.1.1 under Windows 11 using Cygwin and obtained an executable socat.exe. You can use it directly from the Windows command line after adding its location to the PATH. This method provides maximum flexibility to adapt socat to your specific needs.
This will help other users understand and follow the process clearly.