Python3 Black Hat MBP edition (2nd: Network Basics)

Source: Internet
Author: User
Write in front: I wanted to learn python a long time ago, when I bought a book, I decided to start a Python learning journey. First of all, my tools: Using the Sublime Text3 Editor, the main use of the site is the site of the teacher Liao Xuefeng. This is the TCP client #!/usr/bin/env python3#-*-code:utf-8-*-import sockettarget_host= "www.baidu.com" target_port=80client= Socket.socket (Socket.af_inet,socket. SOCK_STREAM) #AF_INET表示IPv4, socket. Sock_stream represents the TCP protocol Client.connect ((Target_host,target_port)) #参数是一个元祖, which contains the address and port number. Client.send (b "get/http/1.1\r\nhost:baidu.com\r\n\r\n") response=client.recv (4096) print (response) Client.close

Python3 Black Hat MBP edition (2nd: Network Basics)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.