Skip to content
Advertisement

Just like IN_ADDRANY can we creat any macro for port number, such that we can bind to any port insteed of a particular port??

I want to receive the data from different ip addr with different port numbers and the reading the data is in infinite loop?

Advertisement

Answer

Can’t be done. It would conflict with all other bound sockets on the system.

If what you really want to do is read any traffic coming in through the network interface, you need a packet capture library such as libpcap.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement