|
From: Steve H. <S.W...@ec...> - 2008-12-23 22:58:30
|
On 23 Dec 2008, at 19:03, Stephen Sinclair wrote: > On Sun, Dec 21, 2008 at 3:17 AM, Kentaro Fukuchi > <fu...@me...> wrote: >> Hi Steve, >> >> It's really nice to have a keep-alive TCP connection of OSC server. >> >> On Wed, 17 Dec 2008 15:59:58 -0500 >> "Stephen Sinclair" <rad...@gm...> wrote: >> >>> So that tells me it might be better to leave them open, so I tried >>> this. It worked for a single connection, by adding a >>> "connected_socket" member to the lo_server structure, and polling >>> that >>> instead of the "socket" member. However, I quickly realized that >>> this >>> would mean that lo_server would need a data structure to track _all_ >>> open sockets. >> >> Common server programs using TCP have the same data structure to >> track them. >> For blocking server, you can use select() system call. > > Exactly, it's already using select() for Windows and poll() for *nix, > so it should be fairly easy to support this. I already started > working on a patch but it's not ready yet. So far I'm using a linked > list to keep the socket information, but I'm trying to decide if this > approach is more complex than necessary. > > Maybe Steve H. can tell me, but I'm not actually sure what advantage > poll() has over select(), actually. Not really my field, but I used to work without shouting distance of a load of network research people, I asked them and they said "use poll(), it's better" or words to that effect :) I vaguely remember that select is only efficient with a small number of sockets/FDs. - Steve |