geekcomputers / geekcomputers/Python
Python socket server not able to listen ESL LUA COMMAND
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 35.4k
- Forks
- 12.9k
- Ø Merge
- 2 Std. 37 Min.
- Gemergte PRs (30 T.)
- 1
Beschreibung
I have created 1 python server which listens on port eg 1234 and lua scripts connects to it . Connection is establishing but not able to send any data to python server. it works well if tried with simple tcp python client .
python server :
"""
import SocketServer
import esl
class ESLRequestHandler(SocketServer.BaseRequestHandler):
def setup(self):
print self.client_address, 'connected!'
fd = self.request.fileno()
print fd
con = esl.ESLconnection(fd)
print 'Connected: ', con.connected()
if con.connected():
info = con.getInfo()
uuid = info.getHeader("unique-id")
print uuid
con.execute("answer", "", uuid)
con.execute("playback", "/ram/swimp.raw", uuid);
# server host is a tuple ('host', port)
server = SocketServer.ThreadingTCPServer(('localhost', 1234), ESLRequestHandler)
server.serve_forever()
"""
# first of all import the socket library
import socket
# next create a socket object
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print "Socket successfully created"
# reserve a port on your computer in our
# case it is 12345 but it can be anything
port = 1
# Next bind to the port
# we have not typed any ip in the ip field
# instead we have inputted an empty string
# this makes the server listen to requests
# coming from other computers on the network
s.bind(('127.0.0.1', port))
print "socket binded to %s" %(port)
# put the socket into listening mode
s.listen(5)
print "socket is listening"
# a forever loop until we interrupt it or
# an error occurs
# Establish connection with client.
c, addr = s.accept()
print 'Got connection from', addr
# send a thank you message to the client.
#c.send('Thank you for connecting')
while True:
d=c.recv(1024)
print
print d
if d == "Status":
c.send("Hey client")
elif d == "c":
c.send("letter c")
elif d == "e":
c.close()
else :
c.send("no data found")
# Close the connection with the client
#c.close()
Lua ESl script :
enter code here
#!/usr/local/bin/lua
require("ESL")
--local command = arg[1];
--table.remove(arg, 1);
--local args = table.concat(arg, " ");
local con = ESL.ESLconnection("localhost", "1234", "ClueCon")
--while con:connected() do
--end
con:send("event plain HEARTBEAT ");
local a = con:recvEvent()
print(a)
--con:sendRecv("event plain HEARTBEAT ")
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit dem Vergleich des Python-SocketServer-Handlers und des Lua-Aufrufs ESL.ESLconnection, und verfolge anschließend den im Issue dargestellten Verbindungs- und Sende-/Empfangsablauf. Reproduziere den Listener an den angegebenen localhost-Ports und ermittle, warum der Lua-Befehl keine Daten an den Python-Server übermittelt; abgeschlossen ist die Aufgabe, wenn der Server den Befehl empfängt und wie erwartet antwortet.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- lua, python
- Bereich
- networking
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 25/100