Dynamic Resizing Of Buffer With ReceiveNetworkData

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
the.weavster
Addict
Addict
Posts: 1576
Joined: Thu Jul 03, 2003 6:53 pm
Location: England

Post by the.weavster »

Rescator wrote:I forget how much exactly, but internet packets are around 1K. (!)
And obviously even if there IS more data to be received, it can't fill up the buffer fully unless it has received that much data. If a long delay or even temporary timeout or packet loss occur, the socket or api may simply give you what it's got so far.

So you have to keep fetching data until it returns 0.
And if the buffer is 100% full there may still be more data waiting, so again, keep reading until you get 0.
And, in the mean time, what do you do with the data you have received so far? - you put it somewhere else in memory. So why can't the command be enhanced just to take care of it?
Rescator wrote:if the buffer is 100% full there may still be more data waiting, so again, keep reading until you get 0.
Rescator wrote:I don't think the PureBasic team should invest any time in this, it would lead to very bad programming practices, memory bloat and fragmentation.
One minute it sounds a piece of cake the next a potential catastrophe.
Post Reply