Folks,

I'm a bit new to Cocoa/iPhone programming, so I apologize
if this is Ye Olde Question Again.  Googling hasn't quite
anwered my quesion yet...

I'm writing a network server that needs to accept many
simultaneous client connections and keep track of them.
I've written the base server parts, roughly in the style
of the Apple Examples (SimpleNetworkStreamsExample).  These
examples, however, only allow one connected client.  I need
to manage several full duplex NSStream in/out pairs.

I can arrange to have a Connected Clients table that contains
both the inStream and outStreams created for the accepted fd
(CFSocketNativeHandle) using some class that glues the inStream,
outStream and clientNumber together in a table.

My problem originates at the point when the stream event
handling delegate is called:

    - (void)stream:(NSStream *)aStream handleEvent:(NSStreamEvent)eventCode

At this point I have the active stream, aStream, in hand, but
I don't know which client it belongs to.  Ultimately, this means
I can't reply to the client for lack of deriving its matching
outStream or clientNumber in my table.

Is there a (void *) data that I can associate with a NSStream
at the time I create it and later retrieve it at stream:handleEvent:
time?  Or do I have to search my client table for a matching
stream handle on every read/write event?

What am I missing?

Thanks,
jdl
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to