server not receiving ip address from client

please check out this question:

i probably should have posted it in this forum
Please remove line 55 from your code.

you do not print the client address. It is like the variable name implies the server address.

To get the client address use getpeername()
remove this line?
getsockname(ListeningSocket, (SOCKADDR *)&ServerAddr, (int *)sizeof(ServerAddr));

what should be in the () of getpeername?
remove this line?
No, look what you've posted in the other thread.

what should be in the () of getpeername?
yes sorry that line should not be there

i have used getpeername already in the code:
getpeername(NewConnection, (SOCKADDR *)&SenderInfo, &nlen);
printf("Server: Sending IP used: %s\n", inet_ntoa(SenderInfo.sin_addr));
printf("Server: Sending port used: %d\n", htons(SenderInfo.sin_port));

but i thought this was the servers ip and port?

so why is the client's ip showing as
Last edited on
Topic archived. No new replies allowed.