Results 1 to 2 of 2

Thread: Networking using QTcpSockets & QAbstractSocket::ConnectionRefusedError

  1. #1
    Join Date
    May 2007
    Location
    Warsaw, Poland
    Posts
    52
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Networking using QTcpSockets & QAbstractSocket::ConnectionRefusedError

    I am new to networking programming.
    As far as I understand a few basic things, I imagine that if I want to use QTcpSocket objects on both (client & server) sides I have to bind&listen somehow one socket (server) and connect the second (client).

    I don't want to use QTcpServer as I do not need server be able to serve more than one connection.

    And now how to execute bind&listen operation using QTcpSocket methods?

    I tried to connectToHost(Qt::LocalHost,port); but no matter what port I choose I receive QAbstractSocket::ConnectionRefusedError...

    I will be grateful for some hints. Dare show me my mistakes if I simply don't understand well the mechanism.

    Regards

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Networking using QTcpSockets & QAbstractSocket::ConnectionRefusedError

    A server must bind/listen/accept.
    A client must only connect(in this case using connectToHost).

    So you get the error because no one is listening on the other end.
    Last edited by marcel; 25th February 2008 at 10:43.

Similar Threads

  1. Networking between applications
    By croland in forum Qt Programming
    Replies: 3
    Last Post: 6th June 2007, 10:35
  2. Qt and Uni-verse Networking Protocol
    By dvmorris in forum Qt Programming
    Replies: 0
    Last Post: 11th April 2007, 09:23
  3. Qt-3 and networking
    By a550ee in forum Qt Programming
    Replies: 3
    Last Post: 3rd October 2006, 11:15
  4. Networking Help please
    By munna in forum Newbie
    Replies: 1
    Last Post: 17th September 2006, 09:35
  5. QTcpSockets and QThreads
    By TheRonin in forum Newbie
    Replies: 3
    Last Post: 21st June 2006, 09:41

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.