D
Dan
I have a problem and I don't quite know how to implement the solution.
I'll have a server application that will listen on a tcp port and make
many similtaneous connections to remote clients. From time to time,
I'll need to write a small amount of data on one of those sockets. A
notification to write to one of the sockets will come from another
program/process.
I think that the best way to send the notification to this server
application is via a udp message. Alternatively, I could use tcp, but
I don't think I'll need the extra complexity for what I want to do.
(Other suggestions welcome.)
The server application will multiplex the connections using 'select',
so much of the time it will be blocked on 'select'.
My problem is how to also listen on a udp port while the process is
blocked by 'select'. Should I run a separate thread? And if so can I
share the socket connection across the two threads? (Thread 1 will be
accepting client connections, thread 2 will we writing data to it.)
Or should I simply let 'select' time out after some period?
I'm a bit lost as to how to do this, I hope someone can put me on the
right track. Any solution that I use should be applicable on Linux
and Windows platforms.
Thanks
Dan
I'll have a server application that will listen on a tcp port and make
many similtaneous connections to remote clients. From time to time,
I'll need to write a small amount of data on one of those sockets. A
notification to write to one of the sockets will come from another
program/process.
I think that the best way to send the notification to this server
application is via a udp message. Alternatively, I could use tcp, but
I don't think I'll need the extra complexity for what I want to do.
(Other suggestions welcome.)
The server application will multiplex the connections using 'select',
so much of the time it will be blocked on 'select'.
My problem is how to also listen on a udp port while the process is
blocked by 'select'. Should I run a separate thread? And if so can I
share the socket connection across the two threads? (Thread 1 will be
accepting client connections, thread 2 will we writing data to it.)
Or should I simply let 'select' time out after some period?
I'm a bit lost as to how to do this, I hope someone can put me on the
right track. Any solution that I use should be applicable on Linux
and Windows platforms.
Thanks
Dan