Skip to content

Latest commit

 

History

History
70 lines (56 loc) · 4.58 KB

python networking cheatsheet.md

File metadata and controls

70 lines (56 loc) · 4.58 KB

Cheatsheet for Python networking, organized into different sections and tables for various commands and concepts related to networking in Python:

Table of Contents

  1. Socket Programming

    Command Description
    socket.socket() Create a new socket
    socket.bind() Bind the socket to an address and port
    socket.listen() Listen for incoming connections
    socket.accept() Accept an incoming connection
    socket.connect() Connect to a remote address and port
    socket.recv() Receive data from the socket
    socket.send() Send data through the socket
    socket.close() Close the socket
    socket.gethostname() Get the hostname of the local machine
    socket.gethostbyname() Get the IP address of a hostname
    socket.getsockname() Get the socket's own address
  2. UDP (User Datagram Protocol)

    Command Description
    socket.SOCK_DGRAM Create a UDP socket
    socket.sendto() Send data over UDP
    socket.recvfrom() Receive data over UDP
  3. TCP (Transmission Control Protocol)

    Command Description
    socket.SOCK_STREAM Create a TCP socket
    socket.getsockopt() Get socket options
    socket.setsockopt() Set socket options
    socket.gettimeout() Get the socket's timeout
    socket.settimeout() Set the socket's timeout
    socket.setblocking() Set whether the socket is blocking
    socket.makefile() Create a file-like object from the socket
  4. Networking Libraries

    Library Description
    socket Basic networking functionality
    http.client HTTP client library
    http.server HTTP server library
    urllib.request URL handling and retrieval
    urllib.parse URL parsing and manipulation
    requests HTTP library for making requests
  5. Networking Protocols

    Protocol Description
    HTTP Hypertext Transfer Protocol
    HTTPS Secure HTTP
    FTP File Transfer Protocol
    SMTP Simple Mail Transfer Protocol
    POP3 Post Office Protocol version 3
    IMAP Internet Message Access Protocol
  6. Security and Encryption

    Command Description
    ssl Secure Sockets Layer
    hashlib Cryptographic hashing functions

Remember to import the necessary libraries/modules before using the commands. This cheatsheet provides a comprehensive overview of Python networking, covering a wide range of concepts and commands. Always refer to the official Python documentation or relevant resources for detailed usage and examples.