Usermessage receiving order

I think usermessages are sent over an UDP connection. UDP itself doesn’t contain any kind of check for which order the packages are received or are they received at all. So does GMod do any kind of internal checking for usermessages? Can I trust that usermessages I send are received in the correct order?

Yes. Everything in the game is sent over a UDP connection, but you don’t see everything else not working.

You shouldnt need to but if you do, use datastream.

Don’t use datastream.

Use RunConsoleCommands

[lua]usermessage.Hook( “someumsg”, function( um )
local id = um:ReadShort()
RunConsoleCommand( “someumsg_recieved”, id )
end )[/lua]

[lua]umsg.Start( “someumsg” )
umsg.Short( 100 )
umsg.End()

concommand.Add( “someumsg_recieved”, function( ply, command, args )
Msg( "Recieved id: " … args[1] … " from player: " … ply:Nick() … "
" )
end )[/lua]

datastream uses usermessages

http://www.facepunch.com/fp/emoot/downs.gif

Also,using datastream for sending simple values is really not needed,it’s like using a whole train to send a simple post letter.

What I had pictured was him trying to stream like a wall of text at 320 characters and going to send two usermessages instead of one to bypass the limit.

Add multiple usermessages that send each value and add it into a table on the clientside?

Send two usermessages each equipped with strings to the client who will put them together.

So if it was like.

Usermessage 1:
String -> abc

Usermessage 2:
String -> cdf

Client Placing:
String -> abccdf

Instead of cdfabc