Socat

From 탱이의 잡동사니
Jump to: navigation, search

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