Could someone point me in the right direction as to getting Qt to connect to a Node.JS running Socket.io server?
I’ve found examples of running Qt as a server, but none reading the data back.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In Qt there are atleast two ways of doing it. Either using blocking or non-blocking calls. If you use non-blocking calls the you “connect” your signals to the slots of the TcpSocket class you are using. The when some data has arrived you get an event/callback is triggered. This is not a complete example:
In your .h file declare the
then in your .cpp file do something like:
To write data you can use tcpSocket_->write(…).
So whenever data arrives the readReady() signal triggers the readTcpData() function and you know there is “some” data available to read from the socket.
Hope it helps and answers your question. Good luck!