TCP and UDP => How do I push?

Blitz3D Forums/Blitz3D Programming/TCP and UDP => How do I push?

bytecode77(Posted 2008) [#1]
hello :)
does anyone know how to push data out into the tcp/udp stream in blitz?
i mean - if i just write one byte into my stream, it will be sent out 50 ms later OR when i filled up ~5MB.
the command under the KNL-UDP-Engine is UpdateNetwor(...), but in pure blitz: how does that work without waiting the 50 ms?
thanks.


boomboom(Posted 2008) [#2]
This is a goof all blitz UDP engine, I don't know if it 'pushes', as far as I see it will just send out data when told, without waiting any time.

http://www.rottbott-studios.com/rottnet.html


bytecode77(Posted 2008) [#3]
hm, isnt that a little bit - or should i say a giantific problem? if blitz sends out everytime you write a byte, thats slow.


boomboom(Posted 2008) [#4]
? It sends out strings as complete messages...


bytecode77(Posted 2008) [#5]
* what happens when i just send a single byte and then nothing for the next 5 seconds? does it arrive with a delay or right away?
* what happens when i send 10 bytes using 10 times WriteByte? does every byte arrive with a delay in between or do they arrive as each?

do i even have to worry about all this or is it OK?


boomboom(Posted 2008) [#6]
AGHHHHH.....Follow up questions!

I don't know, I have only sent stings with it.


boomboom(Posted 2008) [#7]
Why do you want to send individual bytes? You will also have to code up a function to make sure they get processed in the right order, as although you will send them in 1,2,3,4,5 they might arrive in 3,2,1,5...........4


Vertigo(Posted 2008) [#8]
Not to mention that blitz is horribly slow with this sort of thing any any great level due to the fact that you cant multi-thread. Plus with all of the error checking involved with UDP.. jeesh. Why not use an existing library like K-Net or Raknet? No sense in re-inventing the wheel.


Wayne(Posted 2008) [#9]
You can send bytes if you wish, but typically you'll put more into the buffer before sending the datagram. Example you might write out op code byte, and then write integers for x,y,z.. then do SendUDPMsg.

WriteByte(udp_wr,byte1)
; send all characters in the stream buffer.
SendUDPMsg udp_wr,IP,Inp_Port


bytecode77(Posted 2008) [#10]
so you can send a message with udp? why cant you do it with tcp then?


Dreamora(Posted 2008) [#11]
you can do it with TCP as well and if you do it it makes Blitz TCP more performant normally as well if you only check for "did I receive a new packed" ie readavail() > packetsize