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.

code: select all

import os os.popen("nc -v [my ip] [port]")
reason want can send commands via python on netcat e.g.

code: select all

os.popen("hello other computer")
how can fix this. thanks.

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


raspberrypi



Comments

Popular posts from this blog

Connecting Raspberry Pi 2 to P10(1R)-V706 LED Dot Matrix - Raspberry Pi Forums

TypeError: <unknown> is not a numpy array - Raspberry Pi Forums

datso and removing imagetitle - Joomla! Forum - community, help and support