in reply to Re^4: TCP Socket and Serial Port
in thread TCP Socket and Serial Port
In a nutshell, use a single thread for communicating with your serial port. Set up two Thread::Queues: one for inbound commands; one for outbound responses.
When one of your clients sends a command, post it to the inbound queue.
Have your another thread monitor the outbound queue and forward a copy of each thing it dequeues to every connected client.
|
|---|