FROM : Gerriet M. Denkmann
DATE : Thu May 22 21:33:42 2008
On 22 May 2008, at 15:37, Adam R. Maxwell wrote:
>
> On May 22, 2008, at 12:13 AM, Gerriet M. Denkmann wrote:
>
>> I have a server, which does create an NSConnection on some
>> NSSocketPort and publishes this fact via Bonjour.
>> A client opens a connection, sends some messages via Distributed
>> Objects, and closes it again.
>> This implies opening and closing a few file descriptors on sockets.
>>
>> Works fine. Usually.
>>
>> But sometimes some of these socket file descriptors get NOT
>> closed, so they accumulate slowly and when the limit set in limit
>> () is reached, the client blocks forever.
>
> The only way I've been able to get CFMachPorts properly cleaned up
> from NSConnection is to do
>
> [[connection sendPort] invalidate];
> [[connection receivePort] invalidate];
> [connection invalidate];
>
> otherwise they appear to stick around forever (until you run out of
> mach ports). Have you tried something like this with NSSocketPort?
I had not, but I have just implemented this.
And already it looks much better: before it took some arbitrary time
until the sockets disappeared - now they are closed immediately.
You are a genius! Many thanks!
Kind regards,
Gerriet.
DATE : Thu May 22 21:33:42 2008
On 22 May 2008, at 15:37, Adam R. Maxwell wrote:
>
> On May 22, 2008, at 12:13 AM, Gerriet M. Denkmann wrote:
>
>> I have a server, which does create an NSConnection on some
>> NSSocketPort and publishes this fact via Bonjour.
>> A client opens a connection, sends some messages via Distributed
>> Objects, and closes it again.
>> This implies opening and closing a few file descriptors on sockets.
>>
>> Works fine. Usually.
>>
>> But sometimes some of these socket file descriptors get NOT
>> closed, so they accumulate slowly and when the limit set in limit
>> () is reached, the client blocks forever.
>
> The only way I've been able to get CFMachPorts properly cleaned up
> from NSConnection is to do
>
> [[connection sendPort] invalidate];
> [[connection receivePort] invalidate];
> [connection invalidate];
>
> otherwise they appear to stick around forever (until you run out of
> mach ports). Have you tried something like this with NSSocketPort?
I had not, but I have just implemented this.
And already it looks much better: before it took some arbitrary time
until the sockets disappeared - now they are closed immediately.
You are a genius! Many thanks!
Kind regards,
Gerriet.
| Related mails | Author | Date |
|---|---|---|
| Gerriet M. Denkman… | May 22, 09:13 | |
| Adam R. Maxwell | May 22, 15:37 | |
| Gerriet M. Denkman… | May 22, 21:33 |






Cocoa mail archive

