[Interest] QUdpSocket on Windows 10: QNetworkDatagram::destinationAddress/Port not set

Richard Öhlinger r.oehlinger at avibit.com
Wed Oct 4 10:13:12 CEST 2017


On 10/03/2017 04:52 PM, Thiago Macieira wrote:
> If that doesn't fix the issue, can you make a simple example for what fails for
> you? I need to test what's wrong.

I do bind to QHostAddress::AnyIPv4 and I get all the messages, but just 
not destinationAddress/Port.

I've attached a minimal example and a small powershell script to send 
the data.

Regards,

Richard

-------------- next part --------------
# send-udp
#
# Simple Tool to send UDP-Ports to a range with a various source port range.
# you can use Netmon/WireShark on the target to see the incomping traffic.
# i have NO listener to listen on all ports
#
#
# Links: http://pshscripts.blogspot.de/2008/12/send-udpdatagramps1.html

param (
   [string]$remoteip = "239.193.0.11", # IP to send to 
   [int]$remoteudpport=10101,           # port to send to
   [int]$sourceudpport = 0,             # SourcePort, maybe empty uses and available port
   [string]$buffer = "SendUDP Message by msxfaq"
)

$udpClient = new-Object system.Net.Sockets.Udpclient($sourceport) 
$byteBuffer  = [System.Text.Encoding]::ASCII.GetBytes($Buffer)
$sendbytes = $udpClient.Send($byteBuffer, $byteBuffer.length, $remoteip, $remoteudpport)
if ($sendbytes -ne $byteBuffer.length) {
   write-host "Mismatch bytes"
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Test.cpp
Type: text/x-c++src
Size: 748 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20171004/2b4a802d/attachment.cpp>


More information about the Interest mailing list