nc
one time connect
method1:
server:echo test_message | nc -l -p 1234 -w 1
client:echo "hha" | nc 193.168.141.33 1234
method2:
server:echo test_message | nc -l -p 1234 -w 1
curl -i 193.168.141.33:1234
----------------------------------------------------------------------------------------
#!/bin/bash
mark=1
clientip=10.8.0.6
backendip=192.168.14.31
for i in `egrep -v "^#|^$" /etc/services | awk '{print $2}'| awk -F"/" '{print $1}'`
do
echo "-----------------" + $mark + "start---------------------"
echo "connectclient" | nc -l $i &
echo $i
ssh root@$clientip -C "echo connectbackend |nc $backendip $i >> /root/temp"
mark=$(($mark+1))
if [ $(($mark%1000)) -eq 0 ]
then
read -p "please input"
fi
echo "-----------------" + $mark + "end---------------------"
done
----------------------------------------------------------------------------------------