2020-04-06 14:49:56 -04:00
|
|
|
---
|
|
|
|
id: 5e7b9f0c0b6c005b0e76f073
|
2020-04-21 23:37:02 -05:00
|
|
|
title: 'Networking: Write a Web Browser'
|
2020-04-06 14:49:56 -04:00
|
|
|
challengeType: 11
|
|
|
|
videoId: zjyT9DaAjx4
|
2021-01-13 03:31:00 +01:00
|
|
|
dashedName: networking-write-a-web-browser
|
2020-04-06 14:49:56 -04:00
|
|
|
---
|
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
# --question--
|
|
|
|
|
|
|
|
## --text--
|
|
|
|
|
|
|
|
What does the following code create?:
|
|
|
|
|
|
|
|
```py
|
|
|
|
import socket
|
|
|
|
|
|
|
|
mysock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
|
|
mysock.connect(('data.pr4e.org', 80))
|
|
|
|
cmd = 'GET http://data.pr4e.org/romeo.txt HTTP/1.0\r\n\r\n'.encode()
|
|
|
|
mysock.send(cmd)
|
|
|
|
|
|
|
|
while True:
|
|
|
|
data = mysock.recv(512)
|
|
|
|
if len(data) < 1:
|
|
|
|
break
|
|
|
|
print(data.decode(),end='')
|
|
|
|
mysock.close()
|
2020-04-06 14:49:56 -04:00
|
|
|
```
|
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
## --answers--
|
|
|
|
|
|
|
|
A simple web server.
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
A simple email client.
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
A simple todo list.
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
A simple web browser.
|
|
|
|
|
|
|
|
## --video-solution--
|
|
|
|
|
|
|
|
4
|
|
|
|
|