Any reliable UDP network libraries available for PB?

Everything else that doesn't fall into one of the other PB categories.
Nituvious
Addict
Addict
Posts: 1033
Joined: Sat Jul 11, 2009 4:57 am
Location: United States

Any reliable UDP network libraries available for PB?

Post by Nituvious »

Hey all, has anyone developed or created a wrapper for any UDP network layers that feature reliable packets?
▓▓▓▓▓▒▒▒▒▒░░░░░
jassing
Addict
Addict
Posts: 1885
Joined: Wed Feb 17, 2010 12:00 am

Re: Any reliable UDP network libraries available for PB?

Post by jassing »

Nituvious wrote:Hey all, has anyone developed or created a wrapper for any UDP network layers that feature reliable packets?
UDP is not reliable. it's one way....
I wrote syslog server reading udp; I don't think you need any special 'wrappers'.
Nituvious
Addict
Addict
Posts: 1033
Joined: Sat Jul 11, 2009 4:57 am
Location: United States

Re: Any reliable UDP network libraries available for PB?

Post by Nituvious »

jassing wrote:
Nituvious wrote:Hey all, has anyone developed or created a wrapper for any UDP network layers that feature reliable packets?
UDP is not reliable. it's one way....
I wrote syslog server reading udp; I don't think you need any special 'wrappers'.
You can write a routine to keep track of all packets and require acknowledgement of their arrival. I am just wondering if there are any libraries that already do this or even a wrapper of such a library. :|
▓▓▓▓▓▒▒▒▒▒░░░░░
Nituvious
Addict
Addict
Posts: 1033
Joined: Sat Jul 11, 2009 4:57 am
Location: United States

Re: Any reliable UDP network libraries available for PB?

Post by Nituvious »

Question to any PB guru: if I were to store client id as a map, would this make it faster or slower than an array or list to access and modify?

For example, which would be faster?

Code: Select all

Structure ms
	active.b
	somedata.b
EndStructure

Structure fs
	id.l
	somedata.b
EndStructure

NewMap mymap.ms()
Dim myarray.fs(5)

clientid = 33834


myarray(3)\id = clientid
mymap(Str(clientid))\active = 1
mymap(Str(clientid))\somedata = 34

If mymap(Str(clientid))\active = 1 ; check if client is valid 
	Debug mymap(Str(clientid))\somedata
EndIf


For i = 0 To ArraySize(myarray())
	If (myarray(i)\id = clientid)
		Debug myarray(i)\somedata
		Break
	EndIf
Next i
▓▓▓▓▓▒▒▒▒▒░░░░░
jassing
Addict
Addict
Posts: 1885
Joined: Wed Feb 17, 2010 12:00 am

Re: Any reliable UDP network libraries available for PB?

Post by jassing »

I'm no guru -- but it be simple enough to do a few things in a loop and time each method to see which is fastest.

However, I suspect all will be similar; and any edge may be lost on another system with different specs.
Thorium
Addict
Addict
Posts: 1314
Joined: Sat Aug 15, 2009 6:59 pm

Re: Any reliable UDP network libraries available for PB?

Post by Thorium »

Nituvious wrote:
jassing wrote:
Nituvious wrote:Hey all, has anyone developed or created a wrapper for any UDP network layers that feature reliable packets?
UDP is not reliable. it's one way....
I wrote syslog server reading udp; I don't think you need any special 'wrappers'.
You can write a routine to keep track of all packets and require acknowledgement of their arrival. I am just wondering if there are any libraries that already do this or even a wrapper of such a library. :|
Which defeats the purpose of UDP. UDP is only faster than TCP because it isnt reliable. If you add reliability you end up with the same speed as TCP, maybe even slower depending on your implementation.

If you need reliability go with TCP.
Nituvious
Addict
Addict
Posts: 1033
Joined: Sat Jul 11, 2009 4:57 am
Location: United States

Re: Any reliable UDP network libraries available for PB?

Post by Nituvious »

Sending a packet and keeping a record of it does not slow down UDP. Stopping everything when a packet is lost does, this is why I do not want to use TCP.
▓▓▓▓▓▒▒▒▒▒░░░░░
Thorium
Addict
Addict
Posts: 1314
Joined: Sat Aug 15, 2009 6:59 pm

Re: Any reliable UDP network libraries available for PB?

Post by Thorium »

Nituvious wrote:Sending a packet and keeping a record of it does not slow down UDP. Stopping everything when a packet is lost does, this is why I do not want to use TCP.
But that still doesnt change reliability. You have to send back a answer befor you go on with the program, else you dont know if a packet was lost or corrupted. Even worse they could come in in the wrong order. Just logging what packets come in does not change reliability.

UDP should be used if it is no problem if packets get missing. Like for player position updates in a game. Doesnt matter if one of the updates gets lost.
Post Reply