forked from tuxtter/pythonScripts
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtcpclient.py
More file actions
Latest commit
18 lines (12 loc) · 368 Bytes
/
Copy pathtcpclient.py
File metadata and controls
18 lines (12 loc) · 368 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
importsocket
target_host="www.google.com"
target_port=80
# create a socket object
client=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
# connec the client
client.connect((target_host,target_port))
# send some data
client.send("GET / HTTP/1.1\r\nHost: google.com\r\n\r\n")
# receive some data
response=client.recv(4096)
printresponse