Return value of tcp->write is 0 despite sending data

I've been trying out some TCP networking and here's what it says in the docs (I tried to link this but got an error saying I couldn't post a link to that host, the official docs page):

size_t playdate->network->tcp->write(TCPConnection* conn, const void *buffer, size_t length);

Attempts to write up to length bytes to the connection. Returns the number of bytes actually written, which may be less than length, or a (negative) PDNetErr value on error.

The header says this:

int (*write)(TCPConnection* conn, const void *buffer, size_t length); // returns # of bytes sent, or PDNetErr on error

The return type in the docs is clearly wrong (size_t is unsigned, errors cannot be distinguished from a large number of bytes being sent), but I think the stated behaviour is also wrong.

In my testing, a very simple program which opens a TCP socket to netcat running on my laptop and sends some text, the behaviour doesn't match the docs at all. Despite being able to see that all of the text was sent (in netcat's output), the function returns 0. Even when sending megabytes of text, I've not observed this function returning anything other than 0. I can get back a negative value if I close the connection before trying to write to it.

Does a return value of 0 mean "OK" (everything was sent)? Does it ever only send part of the buffer? In that case, does it return the number of bytes sent? So 0 means length was sent, but any other positive value means only part of it was sent?

A separate issue, but does tcp->read not block at all? It returns immediately, no matter what I set the timeout to. Instead, I have to do the timeout myself using tcp->getBytesAvailable.