If I bind a socket to INADDR_ANY I know that it will accept incoming connections on any of IPs configured on the server. Lets say I have 1 IP configured when I make the bind() call and then a new IP gets configured. Will be bind() accept connections initiated to the newly configured IP also or does it work only for the IPs that were existing when bind() was called ?
Share
On Linux when you bind to
INADDR_ANYthen the socket stays bound to0.0.0.0and will accept connection to any local IP address no matter how that changes. Only when a TCP connection is established then the single connection is bound to the IP address it was received on. Other connections may still be received on any address.