In what circumstance is 'size' in network_send_* ever not buffer_tell(buffer)?

andev

Member
As the title asks. Why is it necessary to state the size of the buffer when sending a packet? When would you ever use a different value (and what happens if you do? I assume it crops the buffer but then again?)
 

sp202

Member
If you last wrote to the middle of the buffer or if you haven't completely filled it up then buffer_tell would not be equal to the size.
 

FrostyCat

Member
One situation where you would use a different value is when all the different messages are already pre-written into a buffer, and you're just picking and choosing one to send. In that situation, the size argument would be the length of the chunk you picked, rather than buffer_tell(). This variation hasn't caught on in mainstream GML, however.
 

andev

Member
If you last wrote to the middle of the buffer or if you haven't completely filled it up then buffer_tell would not be equal to the size.
Oh yeah my bad, buffer_size then. I meant in general specifically defining the size of the buffer as an argument rather than just letting it always be the whole thing by default.

when all the different messages are already pre-written into a buffer
What is the benefit of doing this over just keeping them all in their own buffers? The bit of overhead storing multiple pointers to buffers instead of just 1?

This variation hasn't caught on in mainstream GML, however.
Mainstream GML as in the way the GML syntax was developed eventually phased it out?
Or that it's possible but there aren't any tutorials that teach it so people learn to live without it?

Is it possible to send only a chunk of a buffer in game maker (like choosing a start point and total bytes to follow)?
 
Top