在下面的代码中,是在调用close()之前保持与远程服务器的连接打开,还是在每次调用read()时重新创建连接?在下面的代码中,我确实看到每次调用read()时都会发生新的网络通信,而不是在调用urlopen()时立即缓冲远程文件。
import urllib2
handle = urllib2.urlopen('http://download.thinkbroadband.com/5MB.zip')
while True:
buff = handle.read(64*1024) # Is a new connection to the server created
我有一个Ubuntu服务器,它试图连接到远程MongoDB服务器。当我试图通过以下方法连接到远程MongoDB服务器时:
mongo -u user -p pass yourdb.com:27017
它返回以下错误:
2018-06-04T20:41:36.667-0400 W NETWORK [thread1] Failed to connect
to 35.170.208.181:27017 after 5000ms milliseconds, giving up.
2018-06-04T20:41:36.667-0400 E QUERY [thread1] Error: cou