Results 1 to 2 of 2

Thread: How to clear/empty data from a QSslSocket

  1. #1
    Join Date
    Apr 2011
    Posts
    14
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default How to clear/empty data from a QSslSocket

    Hi All,

    it seems that when data is read from a QSslSocket for example using the readLine method the read data is left in the socket.
    so when from the client using the same socket (some time later) more data is sent, the server reads first the data that was sent previously.

    i.e.
    1) connect with server (persistent connection)
    2) client writes: action:add_group\n
    3) server reads the line and does the action
    4) some time later using the same socket the client sends: action:edit_group\n
    5) now when the server reads from the socket it finds: action:add_group\n then the new action:edit_group\n after.

    I thought that when data is read from a socket that data is also removed, but it does not seems the case.
    Is there a way to read and remove data from a QSslSocket?
    Or would it be better to use a new connection per each request ? (rather then persistent connection)

    Many Thanks
    Regards
    _andrea

  2. #2
    Join Date
    Apr 2011
    Posts
    14
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to clear/empty data from a QSslSocket

    [SOLVED]
    sorry about that,
    of course data is removed from the socket when is read.
    because of a bug in the client i was sending the add_group action line twice.

Similar Threads

  1. Clear QTcpSocket buffer before using receiving new data
    By tbscope in forum Qt Programming
    Replies: 2
    Last Post: 26th February 2011, 06:50
  2. Qt for Symbian clear previous data when replace app ?
    By Dexter in forum Qt Programming
    Replies: 0
    Last Post: 16th February 2011, 03:25
  3. How to "CLEAR" data on QTcpSocket
    By wirasto in forum Qt Programming
    Replies: 1
    Last Post: 29th June 2010, 05:38
  4. Replies: 4
    Last Post: 16th January 2010, 10:08
  5. Empty SQL Data from ODBC/FreeTDS
    By dentharg in forum Qt Programming
    Replies: 0
    Last Post: 9th November 2009, 07:50

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.