I know nothing about network programming, but this seems like too broad of a question and not much information. You probably need to experiment yourself first, and based on that experience come back with more precise question or problem.
Thanks for your reply.
I did some prototyping. It turns out that what I need is some middle ware, like rabbitmq but much more lightweight.
The middle ware implements publish/subscribe and request/reply pattern and it should support localhost(inter-process) setup and remote(via socket) setup easily.
I am still working on this. May update later when I have something useful.