Last active
January 10, 2016 15:13
-
-
Save codeboy101/8b7441014d4f8a659bca to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| ## explain the following code : | |
| import socket | |
| my_socket = socket.socket(socket.AF_INET,socket.SOCK_STREAM) | |
| host = 'www.google.com' | |
| port = 80 | |
| remote_ip = socket.gethostbyname(host) | |
| my_socket.connect((remote_ip,port)) | |
| print ('socket Connected to ' + host + ' on ip ' + remote_ip) | |
| message = "GET / HTTP/1.1\r\n\r\n" | |
| my_socket.sendall(message) | |
| reply = my_socket.recv(4096) | |
| print(reply) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment