QUdpSocket的问题

6 篇文章 1 订阅

使用Qt4.6的QUdpSocket类,遇到一个极其坑爹的问题。

在Qt sdk文档中,对QUdpSocket的使用有如下描述:

The most common way to use this class is to bind to an address and port using bind(), then call writeDatagram() and readDatagram() to transfer data. If you want to use the standard QIODevice functions read(), readLine(), write(), etc., you must first connect the socket directly to a peer by calling connectToHost().

于是我选择了第二种方式,使用 connectToHost()连接了通信的双方。然而,悲剧发生了,无论如何也不能把数据发送到对方。各种发送函数都试了。折腾了一整天后把目光盯到 connectToHost()上,删除,测试,一切按预想的发生!我已经出离愤怒了!

在此请过路的神仙和妖精们帮忙解释一下,是我用得不对还是Qt的sdk文档坑爹?
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值