Can a Blender script stay in memory and listen to a socket?
Since neither Blender nor Python deal with threading very well.. one option is to use async-IO to handle the network socket, and hook bpy.app.handlers.scene_update_post to have your script called periodically. 

When your handler is called, you would both process async events on the network sockets, and perform whatever operations were requested by the network. Each interation of your handler should run for a relatively short time, or you'll block the UI.