0

is there any solution for

nc 192.168.1.1 1234 to retry till it gets connected and once it gets connected ; it will send an output via "nc 192.168.1.1 1234" on machine 192.168.1.1 where it is listening on port no. 1234 .

??

//I want to send a message over "nc" once the connection is created by nc command else it will try reconnecting for connection via nc//

2

If you are using bash or similar shell, you could do something like the following;

cat message | while ! nc 192.168.1.1 1234 ; do sleep 1 ; done

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.