|
From: Chris H. <hi...@ya...> - 2006-03-12 02:30:28
|
Hi,
I've been attempting to use a liblo server in TCP mode to send multiple
messages on a connection that stays open. I ended up looking through the
source code and it doesn't seem possible to do this.
In the function,
void *lo_server_recv_raw_stream(lo_server s, size_t *size),
the socket is accepted:
sock = accept(s->socket, (struct sockaddr *)&addr, &addr_len);
then it's used to receive a single message, but there's no way to get to
the connected socket after this. It's not stored anywhere, and apparently
not closed either:
//close(sock);
I've been thinking about how this might be fixed. What do you think about
master/slave servers? The master would listen on the socket, and when a
connection is accept()ed, a new slave lo_server would be created that uses the
new socket. lo_server would need a list of slaves (add a next pointer so they
can be linked together?) and there would probably need to be some functions to
get access to the them: lo_server_get_first_slave(), lo_server_get_next_slave()
or something like that.
Also, as Dave Robillard points out in the bug tracker:
"lo_server_thread_new_with_proto missing
The corresponding function to lo_server_new_with_proto
for server threads is missing, which means you can't
make a server thread which listens to TCP (not good)"
I'm thinking that TCP server threads could work in two ways:
1) New thread for each connection
2) Do the select() thing on all of the slave connections
I may try some of these ideas out and get back with some patches, but wanted to
see what developers thought.
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
|