Note that it prints the information about the server, not the client: 127.0.0.24:9000 is the initial address:port where the client connected; for instance, if you have: client_sock = accept(socket_desc,(struct sockaddr *)&client,(socklen_t*)&c) (after a bind() and a listen()), you see that the information in client is very different from what you get with getsockname(client_sock,&client,&sa_len).
it helped a lot. thanks for maintaining the blog.
ReplyDeleteNote that it prints the information about the server, not the client: 127.0.0.24:9000 is the initial address:port where the client connected; for instance, if you have:
ReplyDeleteclient_sock = accept(socket_desc,(struct sockaddr *)&client,(socklen_t*)&c)
(after a bind() and a listen()), you see that the information in client is very different from what you get with getsockname(client_sock,&client,&sa_len).