gen_tcp bug ?

Claes Wikstrom klacke@REDACTED
Mon Jun 13 13:27:03 CEST 2005


Bengt Kleberg wrote:
> On 2005-06-10 15:38, Claes Wikstrom wrote:

> 
> i think it depends upon how much c programming one has been subjected
> to. 


I think it depends on wether one think it's best
to either:

a) drop the last read data, or
b) deliver it

The best choice should be obvious.


> since there is no receive buffer that can be filled, the length is
> no longer a maximum limit. it is a ''this amount and no other'' request.

I disagree.


> if it returns successfully a non-c programmer would(should?) be very
> surprised if it has read less than length bytes. 


Very wrong, all reads from "slow devices" for example
network sockets can always return less than requested.
That's the way sockets work.



> therefore {error, closed} is ok.

> 
> i am happy with any one of both behaviours. ie, the current behaviour or
> the c like behaviour.
> 
> perhaps {error, closed, Bin} would be a suitable compromise?
> 
>

Well anything except silently dropping the data read
in the last read() call is ok in my book.


/klacke




More information about the erlang-questions mailing list