开发者

C++ Qt write to unix socket

开发者 https://www.devze.com 2023-04-12 14:19 出处:网络
I have a unix socket in /tmp/my_s开发者_开发知识库ock How can I connect to it and write data? Is there a Qt way to do it?Qt supports unix domain sockets natively through QLocalSocket and QLocalServer

I have a unix socket in /tmp/my_s开发者_开发知识库ock

How can I connect to it and write data? Is there a Qt way to do it?


Qt supports unix domain sockets natively through QLocalSocket and QLocalServer.

The name you have to pass as first parameter to QLocalSocket::connectToServer is the socket path: "/tmp/my_sock".


As of 2011, Qt doesn't have any support for sockets at all, since Qt's moto is cross-platforming.

If you want to use sockets in your Qt program, you should implement socket communication via standard Linux functions, socket(), connect(), etc, or implement your own class based on QAbstractSocket.

0

精彩评论

暂无评论...
验证码 换一张
取 消