Maximum number of concurrent NSURLConnections per host?

191 views
Skip to first unread message

zachwaugh

unread,
Jun 4, 2012, 2:51:21 PM6/4/12
to cocoa-...@googlegroups.com

I'm running in to an issue in an OS X app that creates multiple, persistent connections to the same host using NSURLConnection. I create a separate connection for different rooms, and it stays connected the entire time the room is open to consume a streaming API. When opening many rooms, it stops working correctly.

I created a separate sample app that creates 10 connections, and it seems to only allow 6 connections to connect, and the others are queued. Does anyone know if there is a way to override this limit? I can't find it documented anywhere. The only workaround I've found is it seems to be per host name, so testing with "localhost" and "127.0.0.1" allows 6 connections per host. I uploaded a sample project with client and server here - http://cl.ly/1x3K0D1F072V3U2T0C0I.

Thanks,

Zach

Kerri Shotts

unread,
Jun 4, 2012, 5:43:46 PM6/4/12
to cocoa-...@googlegroups.com
It is highly dependent IIRC on the server configuration. Some servers will limit you to as low as one or two persistent connections at a time (mainly those host larger files for download). AFAIK there is no way around this on the client's side-- the client can generate as many connections as it likes, but they will be queued at some specified limit on the server. It is interesting that localhost/127.0.0.1 are treated differently -- I suppose you could work around it by creating multiple aliases in your hosts file? But that's a nasty, nasty hack. On the server side, there should be a config that permits it, though -- what server stack are you using?
Reply all
Reply to author
Forward
0 new messages