Support of non-socket file descriptors like those of a /dev/tty... #1989
-
Hello, my context is mongoose running on a Linux. Is there already a way to add a device like a /dev/ttyUSB0 to the [poll|select]ed list of mg_connections?. If not, I can suggest some simple source mods in a "feature request" post, my tests seem to work although there may be things missing. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Could you ellaborate on your use case, please ? I can't follow you. |
Beta Was this translation helpful? Give feedback.
-
So you have a Linux machine running Mongoose as a websocket server and for some reason you connect an 8-bit hardware with a serial port to one of that LInux machine serial ports. On every call to
|
Beta Was this translation helpful? Give feedback.
So you have a Linux machine running Mongoose as a websocket server and for some reason you connect an 8-bit hardware with a serial port to one of that LInux machine serial ports.
Somehow and for some reason you need to exchange something with the 8-bitter when something happens somewhere.
On every call to
mg_mgr_poll()
, when the select()/poll() call returns, all outstanding connections are polled and receive anMG_EV_POLL
event.On your websocket connection:
MG_EV_WS_MSG
event and you need to exchange something with the 8-bitter, you write to your serial port.MG_EV_POLL
event call, you check your serial port for data from the 8-bitter and read fro…