geekcomputers / geekcomputers/Python
Python socket server not able to listen ESL LUA COMMAND
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 35.4k
- フォーク
- 12.9k
- 平均マージ
- 2時間 37分
- マージ済み PR(30日)
- 1
説明
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 ")
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず Python SocketServer ハンドラーと Lua の ESL.ESLconnection 呼び出しを比較し、次に issue に示されている接続および送受信のフローを追跡します。指定された localhost ポートで listener を再現し、なぜ Lua コマンドが Python サーバーにデータを届けられないのかを特定します。サーバーがコマンドを受信し、期待どおりに応答すれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- lua, python
- 領域
- networking
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 25/100