Socat: Difference between revisions

From 탱이의 잡동사니
Jump to navigation Jump to search
(Created page with "== Overview == Socat - Multipurpose relay (SOcket CAT) 내용 정리. == Example == TCP -> UDP <pre> $ /usr/bin/socat TCP-LISTEN:2223,fork,reuseaddr,bind=10.164.0.17 UDP-CONN...")
 
No edit summary
 
Line 6: Line 6:
<pre>
<pre>
$ /usr/bin/socat TCP-LISTEN:2223,fork,reuseaddr,bind=10.164.0.17 UDP-CONNECT:127.0.0.1:2223,reuseaddr
$ /usr/bin/socat TCP-LISTEN:2223,fork,reuseaddr,bind=10.164.0.17 UDP-CONNECT:127.0.0.1:2223,reuseaddr
</pre>
=== Service ===
Systemd service file example.
<pre>
[Unit]
Description=Socat service for RTPEngine connection.
After=syslog.target network-online.target
[Service]
Type=simple
User=kamailio
ExecStart=socat -T 1 UDP-LISTEN:2223,fork,reuseaddr,bind=10.164.0.17 TCP:127.0.0.1:2223,reuseaddr
ExecStop=/bin/kill -s QUIT $MAINPID
PIDFile=/run/socat-rtpengine.pid
Restart=always
RestartSec=30
[Install]
WantedBy=multi-user.target
</pre>
</pre>


[[category:command/utility]]
[[category:command/utility]]

Latest revision as of 19:58, 22 June 2020

Overview

Socat - Multipurpose relay (SOcket CAT) 내용 정리.

Example

TCP -> UDP

$ /usr/bin/socat TCP-LISTEN:2223,fork,reuseaddr,bind=10.164.0.17 UDP-CONNECT:127.0.0.1:2223,reuseaddr

Service

Systemd service file example.

[Unit]
Description=Socat service for RTPEngine connection.
After=syslog.target network-online.target

[Service]
Type=simple
User=kamailio
ExecStart=socat -T 1 UDP-LISTEN:2223,fork,reuseaddr,bind=10.164.0.17 TCP:127.0.0.1:2223,reuseaddr
ExecStop=/bin/kill -s QUIT $MAINPID
PIDFile=/run/socat-rtpengine.pid
Restart=always
RestartSec=30

[Install]
WantedBy=multi-user.target