Hallo buck,
du hast natürlich nicht die Garantie, dass ein Server, den du nicht selbst betreibst, ein keep alive beherrscht. Darum sollte man nichts davon abhängig machen, und nötigenfalls auf connection close Betrieb zurückgehen können.
Wenns der server beherrscht, kann der Client connection close oder connection keepalive anfordern. In HTTP schaun dann die beiden Varianten folgendermassen aus (http header und socket Ereignisse im Protokoll):
grüsse,Code:lookup connecting connect to 74.125.43.99 bw-in-f99.google.com write GET / HTTP/1.1 Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */* Accept-Language: de-at UA-CPU: x86 Accept-Encoding: gzip, deflate User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322) Host: www.google.at Connection: Keep-Alive read HTTP/1.1 200 OK Cache-Control: private, max-age=0 Date: Sat, 06 Jun 2009 12:19:46 GMT Expires: -1 Content-Type: text/html; charset=UTF-8 Set-Cookie: PREF=ID=adff0003981ad673:TM=1244290786:LM=1244290786:S=-troxoMuBvG5j02J; expires=Mon, 06-Jun-2011 12:19:46 GMT; path=/; domain=.google.at Content-Encoding: gzip Server: gws Content-Length: 3694 ‹ Verbindung bleibt bestehen. Client beendet. disconnect 74.125.43.99 bw-in-f99.google.com lookup connecting connect to 74.125.43.147 bw-in-f147.google.com write GET / HTTP/1.1 Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */* Accept-Language: de-at UA-CPU: x86 Accept-Encoding: gzip, deflate User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322) Host: www.google.at Connection: Close read HTTP/1.1 200 OK Cache-Control: private, max-age=0 Date: Sat, 06 Jun 2009 12:24:35 GMT Expires: -1 Content-Type: text/html; charset=UTF-8 Set-Cookie: PREF=ID=d047bb5ad1568677:TM=1244291075:LM=1244291075:S=iIVLqQ8TszFRQZCI; expires=Mon, 06-Jun-2011 12:24:35 GMT; path=/; domain=.google.at Content-Encoding: gzip Server: gws Content-Length: 3697 Connection: close ‹ disconnect 74.125.43.147 bw-in-f147.google.com Server hat beendet.
Hannes







Zitieren

Lesezeichen