hostname = socket.gethostname() local_ip = socket.gethostbyname(hostname)
Here is what the above code is Doing:
1. We’re creating a socket object.
2. We’re getting the hostname of the machine.
3. We’re getting the IP address of the machine.
hostname = socket.gethostname() local_ip = socket.gethostbyname(hostname)
Here is what the above code is Doing:
1. We’re creating a socket object.
2. We’re getting the hostname of the machine.
3. We’re getting the IP address of the machine.