I have interfaces lo
, eth0
, and eth0:1
.
progA
creates a listen socket, and binds it to port p
on INADDR_ANY
.
Simultaneously, I would like to use ncat
to port forward, listening on the same port p
, but only on the IP address associated with eth0:1
. As expected, ncat
is failing with "address already in use".
What I would like to be able to do is: have progA
bind its listen socket to the addresses associated with interfaces lo
and eth0
, but not to the address associated with eth0:1
, leaving that address open for ncat
to bind to.
Is there an alternative to INADDR_ANY
that allows binding to multiple interfaces and/or multiple IP addresses?