Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QTcpSocket - Connection Refused Error



  • Hello!

    I have just started a bit of socket programming and decided to learn it with Qt. Now, what I am trying to do is connect to localhost but every time i get the "Connection Refused" error.

    Have also tried it with my firewall turned off but still the same thing. Can anyone tell me some reasons for this?

    Thanks in advance



  • You try to connect what?
    Do you have a server process listening on the port you try to connect?
    How did you do it?

    If you provide a small code snippet, it could help us analyzing your problem...



  • Sorry... my knowledge of socket programming is so low that (stupidly) I didn`t know there had to be a server listening to the port also... the connection works now, made a fast server to listen to the port and the connections is made...

    Thanks for the swift reply. Gonna go read some more on this network programming :(



  • I suggest looking at these examples: "network examples":http://doc.qt.nokia.com/4.7/examples-network.html

    The "loopback example":http://doc.qt.nokia.com/4.7/network-loopback.html shows how to communicate between server and client on localhost


Log in to reply