I have a bash script:
#!/bin/bash
while :
do
nc -l -p 30003 | python3 script.py
done
I want that listening works all time.
nc localhost 30003 # works, fine type something Ctrl+C
Try again nc localhost 30003 # not working
So, after socket closed first time, it never open again..
How can I fix it?
- Also I have many defined function inside python script, so I donw want to run it from the beginning. Is it possible?
Thanks.
script.pywritten in a way that it will not close the reading end of the pipe? If so, then you can tellncto keep listening by adding-koption to it.