I found this code on faq. (get the own ip)
But I couldn't understand it. What may I change to make this code work?
http://faq.cprogramming.com/cgi-bin/...&id=1045780608
Code:socklen_t len; struct sockaddr_in other, me; /* ... */ len = sizeof(me); if (connect(some_socket, (struct sockaddr *) &other, sizeof(other)) == 0) { if (getsockname(some_socket, (struct sockaddr *) &me, &len) != 0) { /* getsockname( ) error */ } }