The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
SDLNet_TCP_Recv behavior
vladimir.gamalian


Joined: 13 Jan 2016
Posts: 1
Hello everyone!
I'v tried to make url loader using SDLNet and have confused with SDLNet_TCP_Recv behavior. Documentation pages (https://www.libsdl.org/projects/SDL_net/docs/SDL_net_frame.html) say "Receive data of exactly length maxlen bytes" and "If the number returned is less than or equal to zero, then an error occured, or the remote host has closed the connection.". But actualy (I tried on Windows and checked source file SDLnetTCP.c), there is another behavior. It works like a function recv, i.e. can exit before all required bytes be readed, and return zero only if connection has been closed. I believe that same behavior on Linux and Anroid platforms (based on sources).
Where I could be wrong, or it may be outdated documentation?