通过套接字发送字节的这些方法中哪一种更快?

时间:2017-05-04 16:12:05

标签: python python-3.x sockets

我发送了大量数据,因此尽可能快地发送数据非常重要。

file = open("somefile.anything", "rb")
data = file.read(1024)
while(data):
    s.send(data)
    data = file.read(1024)

这就是我现在正在使用的,但我想知道这个解决方案是否更快:一次发送更多字节。

file = open("somefile.anything", "rb")
data = file.read(4096)
while(data):
    s.send(data)
    data = file.read(4096)

或者两者之间没有区别?

0 个答案:

没有答案
相关问题