need help to translate python script to Qt quick qml code

  • Hi, I am wondering if somebody could help me to translate py- code to Qt qml code because i have one code script in py and one in qml.

    The py code looks like this

    from socket import *
    HOST = ''
    PORT = 8001
    serversock = socket(AF_INET, SOCK_STREAM)
    while 1:
        print("Wait for connection")
        clientsock, addr = serversock.accept()
        print('Connected from' + str(addr))
        while 1:
            data = clientsock.recv(2048)    

    and i wont to translate it and use 'data' variable as angle in my ui in qml. please help me.

  • Moderators

    Hi @antemort,
    It can't be done purely in QML. You will need to use sockets on C++ side. Qt has C++ API's for sockets. QTcpServer creates a server and QTcpSocket for client. After that you will need to expose them to QML.
    Edit: Some one has tried to do that already. See

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.