themoonstone:我是要做一个UDP测试软件,需要设置它的数据包的大小才行啊,你知道怎么做吗
(2014-05-28 15:28) 
不清楚你的测试软件是测试什么的,为什么需要设置这个包的大小(或者 我理解的包大小和你理解的大小不一样?)。
QUdpSocket 内部没有使用buffer,所以他直接依赖你操作系统提供的buffer。【也就是说,你可以直接使用操作系统提供的API来操作它】
QUdpSocket does not use any buffering at all, but rather relies on the implicit buffering provided by the operating system
Datagrams are always written as one block. The maximum size of a datagram is highly platform-dependent, but can be as low as 8192 bytes. If the datagram is too large, this function will return -1 and error() will return DatagramTooLargeError.
Sending datagrams larger than 512 bytes is in general disadvised, as even if they are sent successfully, they are likely to be fragmented by the IP layer before arriving at their final destination.