As any other "server" on the internet (web server, mail server), the server passively waits for connection requests on a certain port. The client initiates a connection to the server to get the data.
It is up to the server program to decide what to serve, so you you can process the data any way you like before it is sent out.
The only important issue: You must ensure that server and client agree on the type of data being exchanged, the rest is up to you.