0

I have an interface with several IP's (eth0, eth0:1, eth0:2) and I'm interested in the called IP, I mean to know which of the available IPs the client is connecting to.

After bind and accept returns information of client but not about our socket.

Jarvis
  • 8,494
  • 3
  • 27
  • 58
Mquinteiro
  • 1,034
  • 1
  • 11
  • 31
  • 3
    Bind and accept do not return information about either end. Use `getsockname` to discover the local address in use, and `getpeername` to obtain the remote address. – Gil Hamilton Feb 24 '17 at 18:18
  • 1
    Have you seen http://stackoverflow.com/questions/15914790/how-to-get-its-own-ip-address-with-a-socket-address and http://stackoverflow.com/questions/10167540/how-to-get-local-ip-and-port-in-unix-socket-programming ? – fvu Feb 24 '17 at 18:18
  • @fvu Thanks your answers are enough good for me but perhaps the related questions could be improved with the listen - accept - getsockname order. – Mquinteiro Feb 25 '17 at 12:22

0 Answers0