Linux – test whether port open using nc

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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 *