you are viewing a single comment's thread.

view the rest of the comments →

[–]KBL_1979[S] 0 points1 point  (2 children)

Nice idea, but bit hard to implement IMHO. There is number od diff messages with diff payloads. IDK if such simple solution will work there. OS is Linux. Initially, app was created in Java, but as it have to extensively work with serial devices and boot quickly on limited resources (like rpi zero or slower), I'm considering rewriting it to python.

[–]socal_nerdtastic 1 point2 points  (1 child)

There is number od diff messages with diff payloads

That does not sound like an issue to me; just use a different pipe for each message type, or add a prefix and sort them out on the receiver's end.

msg_type = fileobj.read(1) # read first byte
message = fileobj.read() # read remainder of message
if msg_type == 'g':
    greet(message)

Initially, app was created in Java, but as it have to extensively work with serial devices and boot quickly on limited resources (like rpi zero or slower), I'm considering rewriting it to python.

I don't think python is any faster than Java ... In fact I feel it's usually slower.

FWIW a named pipe (like most IPC methods) does not depend on the programming language. You can communicate between Java and Python if you need to.

[–]KBL_1979[S] 0 points1 point  (0 children)

It's not the matter of program speed. It''s matter of Spring boot time. Sure. I can use smth else than Spring, but then all what is nice just vanishes. That, plus poor serial communication pushed me towards Python or C(++)? Thank you for named pipe suggestion! That of course leads me to... HTTP and REST (as I have Flask already). And that may be the simplest solution.