0

基本上,标准是否允许这种交互?(Python 伪代码:)

import socket
s = socket.create_connection((host, 80))
s.send("GET /index.html HTTP/1.1\nHost:example.com\nConnection:keep-alive\n\n")
s.recv() // Should be a 200
s.send("GET /websocket HTTP/1.1\nHost:example.com\nUpgrade: websocket\nConnection: Upgrade\n\n")
s.recv() // Should be 101
4

0 回答 0