Linux – test whether port open using nc

yum install nc on server1 and server2  ----> install netcat

on server1
nc -ul 38893 >> test                   ----> listen for udp on port 38893, append to file "test"

on server2
echo "hello test2" > /tmp/testfile
cat testfile2 | nc -u server1 38893    ----> send contents of testfile2 over udp to port 38893 on server1
ctrl-c

on server1
ctrl-c
cat test

"hello test2" is appended to file "test"

Leave a Reply

Your email address will not be published. Required fields are marked *