Showing posts with label SOCKET_STREAM. Show all posts
Showing posts with label SOCKET_STREAM. Show all posts

Thursday, June 7, 2018

QLocalSocket under *nix is SOCKET_STREAM only

While developing a library for Qt to interact with Sense HAT add-on board for Raspberry Pi, I started with the software side, the Sense Emulator. This application emulates the components of the board, and makes the data from emulated sensors, stick and LED matrix available through several files. Under *nix the stick events are provided via a Unix domain local socket as datagrams, constructed in Python like this:

(socket.AF_UNIX, socket.SOCK_DGRAM, '/dev/shm/rpi-sense-emu-stick')

So I thought QLocalSocket was the perfect fit for connecting the library to the Sense Emulator server socket, receive and decode the data and publish it as signals to Qt applications using the library.
But as I started making some tests, I was not able to receive any data. And although everything was in place, it was not working.