I have this code in server program
if ((new_socket = accept(server_fd, (struct sockaddr *)&client_ip,
(socklen_t*)&addrlen))<0)
{
perror("accept");
exit(EXIT_FAILURE);
}
I like to know does second argument to accept(...) (which is of type struct sockaddr * ) get filled with the ip address of client that connects to my server.
For example I like to print the ip address so if I have
struct sockaddr client_ip;
after passing address of above struct sockaddr how to print ip address of client machine. I dont know how to do it the right way
On this link Getting IPV4 address from a sockaddr structure
it shows like this
char *ip = inet_ntoa(client_ip.sin_addr);
I like to know if above char *ip is null terminated or not.