12/22/2023 0 Comments Linux packet sender example![]() ![]() Practically, I have used socat for remote MySQL connections. It is also handy for easily making remote connections. Socat is a great tool for troubleshooting. The command also tells the interface eth0 to accept multicast packets for the given group. In this case, socat transfers data from stdin to the specified multicast address using UDP over port 6666 for both the local and remote connections. The option reuseaddr allows an immediate restart of the server process.Ĥ. If the file does not exist, socat creates it. All data sent by the clients is appended to the file /tmp/test.log. In this example, when a client connects to port 3334, a new child process is generated. Implement a simple network-based message collector: # socat -u TCP4-LISTEN:3334,reuseaddr,fork OPEN:/tmp/test.log,creat,append The above example listens on port 3307, accepts connections, and forwards the connections to a Unix socket on the remote host.ģ. # socat TCP-LISTEN:3307,reuseaddr,fork UNIX-CONNECT:/var/lib/mysql/mysql.sock This example listens on port 81, accepts connections, and forwards the connections to port 80 on the remote host. Use socat as a TCP port forwarder:įor a single connection, enter: # socat TCP4-LISTEN:81 TCP4:192.168.1.10:80įor multiple connections, use the fork option as used in the examples below: # socat TCP4-LISTEN:81,fork,reuseaddr TCP4:TCP4:192.168.1.10:80 Connect to TCP port 80 on the local or remote system: # socat - TCP4:In this case, socat transfers data between STDIO (-) and a TCP4 connection to port 80 on a host named 2. ![]() Let's get started with some basic examples of using socat for various connections.ġ. The syntax for these addresses is: protocol:ip:port Examples of using socat You must provide the source and destination addresses for it to work. The syntax for socat is fairly simple: socat
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |