How to make blender listen to a commandport so other apps can send code to it?
In short: AFAIK Blender doesn't come with such a feature built-in.

You could start an HTTP server and listen to incoming requests. You'll have to use multithreading (can get hairy) if you don't want to block Blender's UI, though. Another approach could be an asyncio socket server. Also see this SE question: send instructions to blender from external application.

Be sure that you only run this on trusted networks, though, and/or use proper encryption &amp; authentication to protect your Blender.