Created
January 7, 2019 00:37
-
-
Save adriaanbd/fe7832748c167a2f794692d000616fbb to your computer and use it in GitHub Desktop.
sockets created by adriaanbd - https://repl.it/@adriaanbd/sockets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
ip = socket.gethostbyname('www.google.com') | |
print("Google's IP is: {}".format(ip)) | |
# My hostname | |
me = socket.gethostname() | |
print("My hostname is: {}".format(me)) | |
# And my ip | |
ip = socket.gethostbyname(me) | |
print("My IP Address is {}:".format(ip)) | |
# My fully qualified hostname | |
fqdn = socket.getfqdn() | |
print("My fully qualified host name is {}:".format(fqdn)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment