# socat

1. Listen on TCP port p1 and current machine IP address and forward traffic to ip2 and port p2.

```
 socat TCP-LISTEN:p1,fork TCP:ip2:p2

# ip2 and p2 can be local machine and p1 can be the new opened port on the same machine.
# fork allows to persist the connection
# socat binary can be copied and directly used on Linux systems: /usr/bin/socat
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ressurect.gitbook.io/notes/cheatsheet/socat.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
