-1

I have an issue with socket.INADDR_* constant of Python socket I cant understand what dose these constants do? For example:

socket.INADDR_LOOPBAD
socket.INADDR_RESERVED

What does the above options do?

Donald Duck
  • 8,409
  • 22
  • 75
  • 99
Alex
  • 3
  • 3

1 Answers1

0

Those constants refer to IP addresses. Refer to your system Unix documentation for what they mean, as indicated in the Python documentation. I don't think socket.INADDR_LOOPBAD or socket.INADDR_RESERVED are real constants.

A few common constants are:

  • INADDR_LOOPBACK (127.0.0.1) - your local host, via a special network device known as the loopback device
  • INADDR_ANY (0.0.0.0) - any address used for binding (accept connections to any IP on the machine)

The IP manual has more useful information on these constants.

Mario
  • 59
  • 6