Kodi Community Forum
Is "kodi-send" limited to a maximum number of command per time ? - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111)
+---- Forum: OS independent / Other (https://forum.kodi.tv/forumdisplay.php?fid=228)
+---- Thread: Is "kodi-send" limited to a maximum number of command per time ? (/showthread.php?tid=349579)



Is "kodi-send" limited to a maximum number of command per time ? - RebornLoophole - 2019-11-26

I my two examples below, in which I successfully use the "kodi-send" command repetitively, Kodi stops temporary with responding to this command.
After a short amount of time it responds again to these repetitive commands, but then again stops responding....etc...etc...etc. 

Example 1:
In the SSH command line of my RPI system with LibreElec I send below kodi-send command to navigate through a menu:
kodi-send --host=192.168.192.18 --port=8080 --action="Up"

Example 2 :
From my Python script I do the same by means of a button that responds to an interrupt:
os.system('kodi-send --action=FullScreen')

In an old support request (See this link) I found a thread that was set to solved because the original poster said it was solved without sharing the details on how he did this.
Question : Is this a known problem or even intended feature of the kodi-send client ?
Is there any way how I can work around this ? If I want to navigate through a menu or increase the volume I want to send as many kodi-send commands as I need.

Looking forward to  your recommendations.
Rene


RE: Is "kodi-send" limited to a maximum number of command per time ? - RebornLoophole - 2019-11-26

The link I referred to is this one: https://forum.kodi.tv/showthread.php?tid=332085


RE: Is "kodi-send" limited to a maximum number of command per time ? - DaVu - 2019-11-28

Does it work better if you put a sleep command after every kodi-send you wrote? Maybe Kodi is simply to slow?! Just guessing.


RE: Is "kodi-send" limited to a maximum number of command per time ? - RebornLoophole - 2019-11-28

Hi DaVu thanks for the suggestion. 
It is certainly not that Kodi is too slow; it easily responds to a (fast) successive number of kodi-send commands.

In the mean time I figured it out and solved it by creating one socket in my python code and use that socket to send the kodi-send command.
Sine this socket is now fixed the maximum number of sockets for this client is not reached (kept at 1) and it is no longer stopping.
Example for "Select" action:

from socket import *
try:
    from kodi.xbmcclient import *
except:
    sys.path.append('../../lib/python')
    from xbmcclient import *
    print "Except clause"

ip = "your.ip.address.here"
# Can also be "localhost"
port = 9777
addr = (ip, port)
sock = socket(AF_INET,SOCK_DGRAM)
pack_select = PacketACTION(actionmessage="Select", actiontype=ACTION_BUTTON)
pack_select.send(sock, addr)