Results 1 to 16 of 16

Thread: Disconnecting & connecting tcpsocket with proxy problem

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2008
    Posts
    15

    Unhappy Disconnecting & connecting tcpsocket with proxy problem

    Hi!

    I don't know why, but i can't connect to another server after disconnecting from previous with same socket ( using proxy ).
    Server sends me http notification "connection established", then my app sends to server ACK and at once closing packet (FIN, ACK).

    Connecting with another (new one ) socket just fine, but not acceptable for my app.
    Looks like i must completely rewrite( or may be reset) socket.
    But how?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Disconnecting & connecting tcpsocket with proxy problem

    Can you show us some code?

  3. #3
    Join Date
    Mar 2008
    Posts
    15

    Default Re: Disconnecting & connecting tcpsocket with proxy problem

    Qt Code:
    1. socket->setProxy(getProxy());
    2. socket->connectToHost(host,port);
    3.  
    4. // ...getting new server's ip...
    5.  
    6. socket->disconnectFromHost();
    7. // socket->abort();
    8. socket->connectToHost(newIp, port);
    9. // <...From here :
    10. //Server sends me http notification "connection established", then my app sends to server ACK and at once closing packet (FIN, ACK).
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Disconnecting & connecting tcpsocket with proxy problem

    disconnectFromHost() is a non-blocking call. You have to wait until you get a disconnected signal before you reconnect to some other host.

  5. #5
    Join Date
    Mar 2008
    Posts
    15

    Default Re: Disconnecting & connecting tcpsocket with proxy problem

    And with abort() function same story?

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Disconnecting & connecting tcpsocket with proxy problem

    same story.

  7. #7
    Join Date
    Mar 2008
    Posts
    15

    Default Re: Disconnecting & connecting tcpsocket with proxy problem

    I have tried to reconnect on disconnected() signal...and...same story.
    Without proxy everything works fine.

  8. #8
    Join Date
    Mar 2008
    Posts
    15

    Default Re: Disconnecting & connecting tcpsocket with proxy problem

    Also i have tried to pause mine app ( from 10 to 60 sec) after disconnecting.
    Connection stream looks just fine:
    calling disconnectFromHost() function and than sleep for n secs.

    Application(A): [FIN,ACK]
    Server(S): [FIN,ACK]
    A: [ACK]

    ..pause..

    new connection
    A : [SYN]
    S : [SYN, ACK]
    A : [ACK] {http connection }
    S : [ACK] {connection established}
    A : [ACK]
    A : [FIN, ACK] { why??? error occurs only with proxy}
    S : [FIN, ACK]
    A : [ACK]

  9. #9
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Disconnecting & connecting tcpsocket with proxy problem

    Maybe the proxy is somehow broken.

  10. #10
    Join Date
    Mar 2008
    Posts
    15

    Default Re: Disconnecting & connecting tcpsocket with proxy problem

    Well. Nope

  11. #11
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Disconnecting & connecting tcpsocket with proxy problem

    How do you know that? It is the proxy that terminates the connection, right? Have you checked it using a network sniffer? Does a packet containing FIN+ACK actually originate from the proxy?

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.