I have a Server (A) and a client (B), written in C, running on the same Linux machine. The server binds a port to INADDR_ANY, and the client binds another port to INADDR_ANY. When another client (C), which is running on another Linux machine, connects to the server, I want the server to get the IP address of client B and send it to client C.
When I'm using getpeername() from the server, it returns "127.0.0.1" which is correct, but I can't send this address to client C- it won't be able to connect to client B with that address.
Is there any smart way to get the actual IP of client B? If it is somewhat easier, I can make each client send it's IP to the server.
Thanks!