UDP Packets from Xojo App Not Computing Checksums

So I’m debugging some network traffic that is being generated by my Xojo app to be used by a listening app that was not written in Xojo. The Xojo app sends out specially crafted UDP packets that conform to what the listener is expecting. I don’t have access to the source or technical information about the listener I’m talking to, so I’m building the Xojo app by duplicating traffic I’m seeing from a known working sending application written in another language.

So, the working packets are identical to the ones sent out by my Xojo app, with one important distinction: There is no checksum being calculated on the Xojo udp packets. In the RFC for UDP, it says that checksums are optional for IPv4, but required for IPv6. I’m using IPv4 at the moment, but wonder why the Xojo app is not creating the checksum…

When I construct a datagram in Xojo and send it out on a UDP socket, is the construction of the actual data to be sent over the wire done purely in native Xojo code, or does it just leverage OS libraries? Is there any way i can force the UDP packets to have their checksums calculated from the Xojo app?

Thanks!

The UDPSocket class just calls through to the underlying BSD socket APIs. In the case of sending a message, it calls sendto.

Interestingly, here is what I’ve learned: When you send out a UDP packet, if you send them to the gateway IP address, the checksum is not calculated on OS X. If you send them to the broadcast or unicast them to a specific IP, they are. Go figure why.

Einhugur has an excellent plugin to avoid all the UDP nightmare, based on the popular ENET. I highly recommend this plugin for UDP development.

Unfortunately, I’m talking to a proprietary wireless hardware device that only speaks vanilla UDP or TCP (well, to be fair, it’s TCP implementation is broken six ways from Sunday, so it really only speaks UDP).

And, honestly, I’ve not found UDP to be all that much of a nightmare… just had to do some reading to get up to speed on the protocol.