What version of the OS are you running? I'm guessing that you're not setting the Connection: Close header and / or you're setting the keep-alive property on the connection, correct?
In general: to use connection keep alive with HTTP Read Streams, you have to overlap open's and close's. This means that you can unschedule and set the client to NULL, but you can't call CFReadStreamClose until you open the next read stream. Keep the previous read stream in an instance variable or something and close it after you open the next request. Of course when you want to actually kill the underlying connection, you can call CFReadStreamClose before opening the next stream. Using keepalive should be a huge performance win for you as well.
Apart from that, if you can prove that you're actually calling CFReadStreamClose and we aren't closing your socket, and you see the socket in CLOSE_WAIT via 'netstat -p tcp', it would appear you've also hit a bug.
PS: What are you really passing to CFSocketInvalidate? The signature is:
void CFSocketInvalidate (
CFSocketRef s
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
|