[Interest] QLocalSocket bug?
Igor Mironchik
igor.mironchik at gmail.com
Tue Jan 5 17:53:16 CET 2016
Hi,
What are you platform on?
On 05.01.2016 19:20, Etienne Sandré-Chardonnal wrote:
> Hi,
>
> I am adapting existing code from QTcpSocket to QLocalSocket (The TCP
> code was used for distributing computations over a network, but since
> I also want to separate the local computation in a sub-process, I'm
> using the TCP code for IPC using QLocalSocket).
>
> On the server side, the readyRead() signal is connected to an
> incomingData() slot which processes data using a loop:
>
> while(socket->canReadLine())
> {
> command = socket->readLine();
> processCommand(command);
> }
>
> Now, when the connection gets closed, I am receiving a readyRead()
> signal after the socket is closed (this is confirmed by
> socket->isReadable() which is false)
>
> But still, socket->canReadLine() returns true, and socket->readLine()
> returns an empty string, which leads to an infinite loop.
>
> I can fix this by adding socket->isReadable() in the loop condition,
> but I am wondering if this is a QLocalSocket bug that should be filed.
>
> Also, why is QLocalSocket not inheriting QAbstractSocket? They share a
> very similar interface, this would make things easier when developing
> somethinh which would use seamlessly network sockets and local pipes.
>
>
> Thanks!
>
>
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160105/4e33a0bb/attachment.html>
More information about the Interest
mailing list