Re: using FDs in a listener
[email protected] (Jonas Borgström) 10 Sep 2002 18:26:50 +0200
| Newsgroups | gmane.network.beep.roadrunner.general |
|---|---|
| Message-ID | <[email protected]> |
Matt Small <[email protected]> writes: > Just a (sort of) quick question. > > I have a list of file descriptors; some of which will be BEEP connections, some > of which aren't. I'm using select() on the lot of them; when I have one that > has an event, I'd like to be able to pass it into the RoadRunner library, and > have it proceed as normal. > > Looking at the functions, it looks almost like I could do this: > > fd=select(); > connection=rr_tcp_connection_new_unconnected(); > rr_tcp_connection_connect_fd(connection, fd, RR_ROLE_LISTENER, ...); > > After this, though, I'm not sure where to proceed. Ideally, I suppose, the > RoadRunner library would then go off and deal with the connection, and close > the fd, letting me continue to wait for other connections (BEEP, or my other > contents.) I can add this connection to an RRListener object, and then start > the main loop, but then I won't be able to service further connections. > why can't you do that? > Is there a way to do this? Any other recommendations? > I'm not sure exactly what you want to do. But this is what RRTCPListener does with the fd returned from accept(2) rr-tpclistener.c:131: tcpc = rr_tcp_connection_new_unconnected (NULL); rr_listener_add_connection (listener, RR_CONNECTION (tcpc)); rr_tcp_connection_connect_fd (tcpc, fd, RR_ROLE_LISTENER, NULL); g_object_unref (G_OBJECT (tcpc)); After this roadrunner will take care of the new connection, exchange greetings, start and close channels and finally close the fd. Did this answer you question? / Jonas -- Jonas Borgström [email protected] CodeFactory AB http://www.codefactory.se/ Office: +46 (0)90 71 86 10 Cell: +46 (0)70 248 89 58