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
|
|
|
|
---
|
|
|
|
|
|
|
|
## Description
|
|
|
|
<section id='description'>
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
## Tests
|
|
|
|
<section id='tests'>
|
|
|
|
|
|
|
|
```yml
|
|
|
|
question:
|
2020-05-28 22:40:36 +09:00
|
|
|
text: |
|
|
|
|
What does the following code create?:
|
|
|
|
|
|
|
|
```py
|
|
|
|
import socket
|
2020-06-23 17:36:39 +05:30
|
|
|
|
2020-05-28 22:40:36 +09:00
|
|
|
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)
|
2020-06-23 17:36:39 +05:30
|
|
|
|
2020-05-28 22:40:36 +09:00
|
|
|
while True:
|
|
|
|
data = mysock.recv(512)
|
2020-05-31 13:57:09 +01:00
|
|
|
if len(data) < 1:
|
|
|
|
break
|
|
|
|
print(data.decode(),end='')
|
2020-05-28 22:40:36 +09:00
|
|
|
mysock.close()
|
|
|
|
```
|
|
|
|
|
2020-04-06 14:49:56 -04:00
|
|
|
answers:
|
2020-05-31 13:57:09 +01:00
|
|
|
- |
|
|
|
|
A simple web server.
|
|
|
|
- |
|
|
|
|
A simple email client.
|
|
|
|
- |
|
|
|
|
A simple todo list.
|
|
|
|
- |
|
|
|
|
A simple web browser.
|
2020-04-06 14:49:56 -04:00
|
|
|
solution: 4
|
|
|
|
```
|
|
|
|
|
|
|
|
</section>
|