![Mastering Python for Networking and Security](https://wfqqreader-1252317822.image.myqcloud.com/cover/385/36699385/b_36699385.jpg)
上QQ阅读APP看书,第一时间看更新
Socket methods
These are the general socket methods we can use in both clients and servers:
- socket.recv(buflen): This method receives data from the socket. The method argument indicates the maximum amount of data it can receive.
- socket.recvfrom(buflen): This method receives data and the sender's address.
- socket.recv_into(buffer): This method receives data into a buffer.
- socket.recvfrom_into(buffer): This method receives data into a buffer.
- socket.send(bytes): This method sends bytes data to the specified target.
- socket.sendto(data, address): This method sends data to a given address.
- socket.sendall(data): This method sends all the data in the buffer to the socket.
- socket.close(): This method releases the memory and finishes the connection.