Suchen

Registrieren

Vielen Dank für Deine Anmeldung! Du bekommst nun eine Email mit einem Aktivierungslink.

username already taken
Du hast bereits einen Account? .

Login

Passwort vergessen?
Du hast noch keinen Account? Registrieren um den UI-Designer und das Forum zu benutzen oder eigene Projekte anzulegen.
Log dich ein um Beiträge schreiben zu können!



pushing NetIO - what are the limits?

#1 März 25, 2019 18:37:17 by francolargo

pushing NetIO - what are the limits?

Greetings,

I have been using NetIO very happily on a BBB/Debian, where multiple control surfaces can simultaneously interact with one instance of netio_server.py on the BBB.

Now I want to do more. I want to have each of those control surfaces ALSO control a second instance of netio_server.py that is running on a RPi. This RPi is a server running 24/7, and I want it to also be a remote power controller for the BBB (and the hardware it controls, requiring particular sequences of I/O). It works up to a point. The RPi can be programmed to start the BBB system and things work well. The remote control surfaces are nice in this situation because the buttons from the RPi are highlighted and active, but the other controls for the the BBB are dimmed until boot-up is successful. Perfect. BUT…

Things fail when the BBB's work is done and RPi commands it to enter the shutdown sequence. After the BBB version of netio_server.py is killed during shut-down, the running netio_server crashes on the RPi and leaves us this:
Connected from ('10.0.1.7', 64388)
Connected from ('10.0.1.5', 60389)
shutdown called
Traceback (most recent call last):
File "netio_master.py", line 226, in <module>
readwrite(obj, flags)
File "netio_master.py", line 192, in readwrite
obj.handle_close()
File "netio_master.py", line 41, in handle_close
self.pollster.unregister(self)
File "netio_master.py", line 208, in unregister
fd = obj.fileno()
File "/usr/lib/python2.7/socket.py", line 228, in meth
return getattr(self._sock,name)(*args)
File "/usr/lib/python2.7/socket.py", line 174, in _dummy
raise error(EBADF, 'Bad file descriptor')
socket.error: [Errno 9] Bad file descriptor

I will appreciate any specific or even more general ideas. I could send commands for a more orderly removal of the BBB client/server, but I don't know what they might be. Once any function in the BBB's netio_server is lost, communication is also lost even though ports remain open. Perhaps I could trigger an ‘outside script’ (not a netio_server handle command) to independently manage ports and bindings before the BBB goes down. The crashed RPi netio_server code binds each RPi port to a) an sh process, b) an nc process, and c) a python process. Big picture: I prefer to stay with Python if possible…

Ideas?

Many thanks in advance!

Frank

Editiert francolargo (März 25, 2019 19:02:36)

#2 März 26, 2019 04:28:13 by francolargo

pushing NetIO - what are the limits?

One more detail: The above errors only happen if the RPi server code is running as a daemon. If I start it withour the trailing ‘&’, it functions without error. :-/

#3 März 26, 2019 14:31:40 by mcgiver0510

pushing NetIO - what are the limits?

hi,

The error occurs because the BBB disconnects the socket at shutdown while the RPI is still accessing it.
So you have to disconnect the socket connection from the RPI to the BBB as well.

lg

#4 März 26, 2019 16:06:01 by mcgiver0510

pushing NetIO - what are the limits?

hi francolargo,

I changed the old server
here is the new server which now runs under Python 2.xx and Python 3.xx

lg

Anhänge:
attachment NetIO_Server.py.zip (1,4 KB)

#5 März 27, 2019 13:33:57 by francolargo

pushing NetIO - what are the limits?

Thank you very much for the newer server code!
I code only for this hobby, so gaining knowledge about low-level functions in Python modules is a big challenge. It is better to spend time making the NetIO application better serve its purpose than making it function at all.

Best regards,

Frank