I'm trying to communicate an external python script with a C++ program that allows qt-scripting. The goal its to partially control the C++ program (using its qtscript api functions) from python code.
I know how to create a basic socket server/client in python:
#Server code
import socket
server = socket.socket()
server.bind (("localhost", 8080))
server.listen(10)
client, client_adress = server.accept()
while True:
message= cliente.recv(1024)
if message== "quit":
break
print "Received:", message
client.send(message)
print "Goodby"
cliente.close()
server.close()
...
#client code
import socket
client = socket.socket()
client.connect(("localhost", 8080))
while True:
message = raw_input(">" )
client.send(message)
if message == "quit":
break
print "Goodby"
But I can't find much info on how to do it in qtscript (No javascript experience), I know there is the QTcpSocket Class, but I'm not really sure where to start to get a snipet like the python ones I have. There is this question, but it was not useful to my problem. And there is this samples but I can't make it work.
Whats is better, the client or the server in Python? Could I can find a qtscript example?