Peter Fortuin
Peter Fortuin

Reputation: 5228

Using linux sockets the QT way?

I have been googling this, but I can't seems to find it.

Is there a QT way to use linux sockets? It looked like the QSocket class is used for network sockets and not for local linux sockets.

Anyone knows anything about this? And maybe a tutorial to get started?

Upvotes: 2

Views: 2576

Answers (2)

guruz
guruz

Reputation: 1614

QSocket ? I think you're looking at the wrong Qt version :)

For the recommended Qt (4.6) there is QTcpSocket for TCP sockets. If you mean local domain sockets there is QLocalSocket.

http://doc.qt.digia.com/4.6/qtcpsocket.html

http://doc.qt.digia.com/4.6/qlocalsocket.html

Do not use a 0-timer and do not use threads. There is no need for that, you get notified with the readyRead() signal if there is new data.

Upvotes: 5

ctd
ctd

Reputation: 1793

Look at 'Local Fortune Client' and 'Local Fortune Server', under IPC in the QtCreator demos. Those use QLocalSocket, which is a local domain socket in *nix.

Upvotes: 2

Related Questions