PDA

View Full Version : How to clear/empty data from a QSslSocket



scieck
7th May 2011, 11:04
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

scieck
8th May 2011, 00:47
[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.