Get Remote Address / IP -C Berkeley Sockets

If I have a related socket file descriptor (either using connect or bind), enter SOCK_STREAM , can I get the remote address / IP address?

I need to do this inside a function where I have no data other than a socket file descriptor.

+4
c ++ sockets ip-address berkeley-sockets
source share
2 answers
+7
source share

See the getsockname () system call.

0
source share

All Articles