Isnt there some kind of error EGAIN or something like that, that recv will return when theres no more data?