Node: How to keep persistent incoming connection?
Solution: The node has been sending my script ping messages, but my script was not responding with pong messages.


  The ping message is sent primarily to confirm that the TCP/IP connection is still valid. An error in transmission is presumed to be a closed connection and the address is removed as a current peer. https://en.bitcoin.it/wiki/Protocol_documentation#ping


Therefore, my script "node" appeared to be unresponsive, so the local node would drop the connection.



Thanks to Pieter Wuille for pointing me in the right direction.