简体   繁体   中英

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?

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM