#!/bin/sh

# port must be < 1024
port=123

echo foobar | timeout 1 netcat -l -p $port
rc=$?

# if the command timed out, it means success
if test $rc -eq 124; then rc=0; fi

exit $rc
