If I understand you, you want three programs, connected as follows:
+--------+ +-----------+ +--------+ | Client | <---> | "Channel" | <---> | Server | +--------+ +-----------+ +--------+
The "channel" program is acting as a proxy between the server and the clients.
For this to work you have to create the "channel" program to act as both server and client. It acts as a server in the way that the client programs connect to it instead of the actual server. When the "channel" program receives a new client connection, it acts as a client by itself connecting to the real server.
Then you have to keep track if the socket pairs (client and server connections) so that when you receive input from one socket, you process it and send the processed data on to the other socket. So if a client sends data, you receive it in the "channel" program and do whatever processing is needed, and then send it on to the real server. And the same for the other way round.