这两天看了一篇文章,全栈工程师系列。可以参考。
http://www.shareditor.com/bloglistbytag/?tagname=%E6%95%99%E4%BD%A0%E6%88%90%E4%B8%BA%E5%85%A8%E6%A0%88%E5%B7%A5%E7%A8%8B%E5%B8%88%28Full+Stack+Developer%29
~]$ nc -l -p 8080 GET / HTTP/1.1 Host: 10.117.146.16:8080 Connection: keep-alive Upgrade-Insecure-Requests: 1 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 Accept-Encoding: gzip, deflate, sdch Accept-Language: zh-CN,zh;q=0.8,en;q=0.6,zh-TW;q=0.4,ja;q=0.2
继续敲写
HTTP/1.1 200 OK Content-Type: text/html; charset=UTF-8 Connection: close hello hi <html> <body> <h1>hello</h1> </body> </html>
浏览器显示字符。
如果客户端(浏览器页面)关闭,则nc退出。
时间: 2024-10-14 09:03:58