Re: several NSConnections on my DO server ?
Re: several NSConnections on my DO server ?
- Subject: Re: several NSConnections on my DO server ?
- From: Aurélien Hugelé <email@hidden>
- Date: Mon, 7 Mar 2005 16:15:27 +0100
it was not really a success :-(
i'm detaching a thread for each "children" connection, but the new connection is not running in the new thread, it is still treated in the parent thread and run loop...
any help ?
On 7 mars 05, at 15:32, Aurélien Hugelé wrote:
ok i partly succeed to achieve a thread by client by using NSConnection delegate method :
<x-tad-smaller>- (BOOL)connection:(NSConnection *)</x-tad-smaller>parentConnection<x-tad-smaller> shouldMakeNewConnection:(NSConnection *)</x-tad-smaller>newConnnection
in this method i added [newConnnection runInNewThread]'
for the moment i have problem to cleanly exit the detached thread (when the client **cleanely** die, the thread is not exited...)
i'm on the way !
no opinions on the thread per client architecture ?
On 7 mars 05, at 13:57, Aurélien Hugelé wrote:
hi list !
i have written a small DO architecture with a DO server and some clients.
i need both way communication (the server knows each clients and can message them at any time, and of course each clients can message the server)
currently, on the server part, i have the main thread and a secondary thread in which runs the NSConnection.
After reading the doc again and again (DO are not very wall explained IMO...) i thought that this part is extremly important :
• If an NSConnection exists that uses
receivePort as both of its ports, it’s treated as the parent of the new NSConnection, and its root object and all its configuration settings are applied to the new NSConnection. You should neither register a name for nor set the root object of the new NSConnection. See “Configuring an NSConnection” for more information.
As i understand it, you can manage several NSConnections (and NO, it is not in “Configuring an NSConnection” documentation !!).
What i basically want is to detach (on the server) a thread for *each* of my clients, and run a (or the ?) NSConnection in the detached thread.
I want each client to have its own NSThread on the server side to avoid any blocking (suppose a client crash, a single thread would block all clients... ok i know there are some timeouts exceptions, but i think a multithreaded server is a better option)
i "feel" it is good design to have a thread per client, but i'm not sure. What is you opinion ?
How can i achieve this ? the NSConnection delegate method "makeNewConnection:" makes me think this is feasible ! but poorly documented...
where would i create the new NSConnection and detach the client thread (or maybe use runInNewThread method) ? i think the right time is when the client register itself to the server.. but i'm not sure...
i think i have the pieces of the puzzle... but i'm not sure how to put them together !
can someone help me ?
thanks to all DO masters !
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden