Originally posted by cranium2004
I want to get client ip address at server side from whom i am receving UDP sockets connection and print it at server udp socket. How can i do that?
How do you receive packages?
If you are using receivfrom:
ssize_t recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr
*from, socklen_t *fromlen);
the struct sockaddr *from
is filled with the client information, if it's not NULL. The sin_addr.s_addr
field, should be field with the client IP.