tags:

views:

57

answers:

1

How can I distinguish between "listener" file descriptors and "client" file descriptors?

Here's what I saw in the manpage example:

if(events[n].data.fd == listener) {
    ...
} else {
    ...
}

'But what if I don't have access to listener?

Sorry if this is a vague question. I'm not quite sure how to word it.

+3  A: 
Nikolai N Fetissov
This way one can also associate a call-back function(s) with the file descriptor.
Dummy00001
Yep, it's kind of ... oh the horror ... object-oriented :)
Nikolai N Fetissov
Surely you can fit a `goto` in there, somewhere! +1, I also use small structures (with *gasp* logging callbacks).
Tim Post
This is what I had in mind as well, but wanted a simpler solution. It'll be even more complicated, since I was going to have a separate structure for client sessions (holding more than just the fd and flags)! Feels wrong. Anyway, thanks for the help. Tick :)
someguy