为什么python套接字库不包括像sendall()这样的recvall()方法? [英] why does python socket library not include recvall() method like sendall()?

查看:50
本文介绍了为什么python套接字库不包括像sendall()这样的recvall()方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用recv()方法时,有时我们无法接收到我们想要的数据,就像使用send()一样.但是我们可以使用sendall()来解决发送数据的问题,接收数据呢?为什么没有这样的 recvall() 方法?

When using recv() method, sometimes we can't receive as much data as we want, just like using send(). But we can use sendall() to solve the problem of sending data, how about receiving data? Why there is no such recvall() method?

推荐答案

为什么不能作为标准库的一部分提供这样的函数没有根本原因.事实上,已经至少有一次尝试添加recvall().

There is no fundamental reason why such a function could not be provided as part of the standard library. In fact, there has been at least one attempt to add recvall().

鉴于它可以轻松实现为围绕 recv() 的循环,我不认为这是一个重大遗漏.

Given that it can be easily implemented as a loop around recv(), I don't think that this is a major omission.

这篇关于为什么python套接字库不包括像sendall()这样的recvall()方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆