UDP

BlitzMax Forums/BlitzMax Programming/UDP

Ked(Posted 2009) [#1]
Is BlitzMax's UDP reliable, ordered, or neither? Would it be possible to make BlitzMax's UDP reliable or ordered? I would personally like to not use any external libs (GNet, BNet, Raknet, etc).

I'm pretty sure this has been asked many times, but can someone point me to some UDP tutorials?


TaskMaster(Posted 2009) [#2]
I read something once that said something to the effect of:

If you try to make UDP ordered and reliable, you will just end up creating TCP. :)

Anyway, Blitz's UDP is just plain UDP. If you want it to be ordered and reliable, you are going to have to do it yourself, which means, doing something like serializing the packets, so you know the order they should be in and if one is missing. Then a method to ask for a packet to be retransmitted if you miss a packet. You also may want to attach a CRC or something to your packets for data integrity.


plash(Posted 2009) [#3]
@TaskMaster: I've heard that one too :D

Max's UDP is just UDP. If you want a more powerful engine maybe try BNet or RakNet?


lukehedman(Posted 2009) [#4]
The appeal of UDP is unreliability. Packets are "fire and forget", which is great for constant data like position and velocity.

From what I understand, the new threading support means TCP could work without locking up the rest of the program, so it's great for reliable transmission. You'll have fewer firewall issues too.

Just my $.02 on the matter. There are benefits to reliable UDP. The Torque networking library is pure UDP, and it's excellent.

That's what I've heard anyway...

I have some networking experience, but it's with .dll stuff only. With BlitzMax and raw sockets I am such a n0Ob. :-D

I'll be watching this thread for more info as networking interests me a lot too. If I do manage get something working I'll try and give you a shout.


Wayne(Posted 2009) [#5]
You also may want to attach a CRC or something to your packets for data integrity.


why add crc when udp protocol already does that ?


Ked(Posted 2009) [#6]
I downloaded BNetEx. I read the licensing information and everything, but just to make sure: Am I allowed to include this in a commercial program? All I have to do is include the authors' names?


plash(Posted 2009) [#7]
I believe that is correct.


TaskMaster(Posted 2009) [#8]
I didn't know UDP did a crc check. If so, then no need to do your own, obviously. :)

From Wikipedia:

UDP uses a simple transmission model without implicit hand-shaking dialogues for guaranteeing reliability, ordering, or data integrity. Thus, UDP provides an unreliable service and datagrams may arrive out of order, appear duplicated, or go missing without notice. UDP assumes that error checking and correction is either not necessary or performed in the application, avoiding the overhead of such processing at the network interface level.

It does go on to explain that there is a checksum that includes the header and data. But the checksum on IPv4 networks is optional.