#include #include int main() { struct sockaddr_storage sa; socklen_t sz; sz = sizeof(sa); getsockname(0,(struct sockaddr*)(&sa), &sz); return 0; }