Netcat connection closes after connecting through python - Raspberry Pi Forums
so have installed netcat on raspberry pi , mac , can them connect easily. problem if want python script on mac establish connection when raspberry pi listening connection. connect, close connection imediatly. use code.
reason want can send commands via python on netcat e.g.
how can fix this. thanks.
code: select all
import os os.popen("nc -v [my ip] [port]")
code: select all
os.popen("hello other computer")
os.popen depricated.
instead @ subprocess module https://docs.python.org/2/library/subpr ... cess.popen
in particular @ communicate method https://docs.python.org/2/library/subpr ... ommunicate
petero
instead @ subprocess module https://docs.python.org/2/library/subpr ... cess.popen
in particular @ communicate method https://docs.python.org/2/library/subpr ... ommunicate
petero
raspberrypi
Comments
Post a Comment