WriteString(stream)

Blitz3D Forums/Blitz3D Programming/WriteString(stream)

AngelOnFira(Posted 2014) [#1]
I have recently been experimenting with the capabilities of sending strings over UDP streams. Here are the interesting facts I found;


-When sending UDP messages, if the program is currently not waiting for the messages, they will stack up and wait until it starts checking.

-Strings can be send as fast (I believe) as the computer can run through.

-Only one string/line can be bound to the stream before it is sent. Any other ones that are added would just replace the string/line before it.

I am most interested in the third one, is there anything I'm missing with it, or are there any ways to attach more than one line to a stream? My application for this is when you are sending player information to new players joining a server. I would help most if I could send all of the player's information in one stream. Or I could combine everything into one stream and buffer it, but that seems messy. So any suggestions? Or anything else on the topic of streams that I may have missed? Any comment whatsoever is appreciated!


AngelOnFira(Posted 2014) [#2]
Anyone know???


Wings(Posted 2014) [#3]
"-When sending UDP messages, if the program is currently not waiting for the messages, they will stack up and wait until it starts checking."

Reply:
Not true, UDP Messages is send instant. not wayting or delaying.
exeption your network devices may cash and delay packets. router,switch Proxy etc..




-Strings can be send as fast (I believe) as the computer can run through.

Reply:
True. but not in order as you send them.






-Only one string/line can be bound to the stream before it is sent. Any other ones that are added would just replace the string/line before it.

Reply:
Not True, Strings is sent in inststant. may not arive in same order. so second string may arrive Before firtst. its also posible first string never arive only second cause of network issue.


Solution:
use TCPIP for safe arival of data.

If you using udp my king Arthas Count on you failing.
and se you code self handle packet resending etc.
as UDP dose not check or Waits for anything.


AngelOnFira(Posted 2014) [#4]
What I mean by only one string being sent at a time is that I found that when I write a string to a stream, I have to send it right away, I cannot add another string to the stream and have it sent as well, it will delete the other one and replace it with itself. I think.

Other than that, why would I use TCP for a lan game? TCP is to make sure that the data gets to where it needs, UDP is for speed. If I was connecting to a master server list, or to an achievement server or something of the nature, I believe I would use UDP? I know most games, even online multiplayers will use UDP...


Wings(Posted 2014) [#5]
please post an example. code.

i only use TCP as it covers over 150 sessions of players running in mine mmo :)