I am imlementing a didtributed banking system.
There are 4 bank branchs need to communicate to each other ,get balance and transfer money from one branch to another, so they need to act both as a server and client?

I know how to write a program in a standard client communicates to server and server respond to cliemt but I have no idea how to let them both act as a server and client.

And if I use socket, the client (or server) will just send a stream to server, so how could the server (or client) know what's kind of operation he need to do?

Anyone know how to do it? Please help me.

thanks