#!/bin/bash

IP=$1
PORT=$2
PORT_LISTEN=$3

if [ "$IP" = "" ]; then
  echo "Usage: $0 <ip_to> [<port_to>] [<port_listen_to>]"
  exit
fi

if [ "$PORT" = "" ]; then
  PORT="5900"
fi

if [ "$PORT_LISTEN" = "" ]; then
  PORT_LISTEN="13600"
fi

echo "Listen to port $PORT_LISTEN and redirecting to $IP:$PORT"

tcpserver -vRH 0 $PORT_LISTEN nc -w 600 $IP $PORT

