Reading data from the network without knowing the size of the buffer that is coming

Adam D. Ruppe destructionator at gmail.com
Thu Mar 21 19:21:23 UTC 2019


On Thursday, 21 March 2019 at 18:27:56 UTC, Andre Pany wrote:
> If the data received is smaller than 256 bytes, the array will 
> contain NULL (character 0 value in the ascii table). This you 
> might could use as indicator you received all values.


That's wrong, the correct thing to check is the return value of 
receive(). It gives the length it actually filled in (or 0 if the 
connection is finished, or negative on error conditions)


More information about the Digitalmars-d-learn mailing list