OC_ASIHTTPRequest

http://wiki.magiche.net/pages/viewpage.action?pageId=2064410

coder时间不短,但netword这一块比较缺乏经验,
看过大块头《UNP》,但还是一头污水。

同步、异步、阻塞、非阻塞,是4个不同的概念,初哥往往会搞混。

网络超时的概念

监听的模式


http://allseeing-i.com/ASIHTTPRequest/


http://blog.csdn.net/kmyhy/article/details/6963925

// When YES, requests will keep the connection to the server alive for a while to allow subsequent requests to re-use it for a substantial speed-boost
// Persistent connections will not be used if the server explicitly closes the connection
// Default is YES
BOOL shouldAttemptPersistentConnection;


ASIHttpRequest的所有调试日志,发现ASIHttpRequest似乎在尝试用上次的连接去连接服务器:

Request #3 will use connection #2

Request attempted to use connection #2, but it has been closed -will retry with a new connection

Request #3 will use connection #3


kmyhy:“它好像连接时重用上次的http连接。
这样肯定是不行的,因为上次的http请求结束后服务器已经把连接关闭了。
于是我们只能把ASIHttpRequest的连接重用关闭:
[request setShouldAttemptPersistentConnection:NO];

这样,前面的问题就不会出现了。
其实,在不同的http会话中,不应该开启PersistentConnection。”

你可能感兴趣的:(ASIHTTPRequest)