Page 1 of 1

writeall error codes

Posted: Tue May 05, 2009 12:04 pm
by craiglindley
Can someone tell me where I find out what the error codes returned from the writeall function are? I'm using it with a socket and I sometimes get negative values (-2 and -3 specifically) returned.

The error codes should be documented in the same doc as the writeall function but they are not as far as I can tell.

Thanks

Re: writeall error codes

Posted: Tue May 05, 2009 12:27 pm
by Forrest
This error changes based on if you are writing to a TCP socket, serial socket, or other. Because -2, or some other value can have different meanings, this is not documented, and you have to follow the source to find it.

What kind of socket are you writing to?

Re: writeall error codes

Posted: Tue May 05, 2009 12:57 pm
by craiglindley
I'm writing to a TCP socket serving an HTTP request.

Re: writeall error codes

Posted: Tue May 05, 2009 1:09 pm
by Forrest
Here are the TCP err values. Not all of these can come from a write attempt, but all tcp socket errors are defined :>

#define TCP_ERR_NORMAL (0)
#define TCP_ERR_TIMEOUT (-1)
#define TCP_ERR_NOCON (-2)
#define TCP_ERR_CLOSING (-3)
#define TCP_ERR_NOSUCH_SOCKET (-4)
#define TCP_ERR_NONE_AVAIL (-5)
#define TCP_ERR_CON_RESET (-6)
#define TCP_ERR_CON_ABORT (-7)

Re: writeall error codes

Posted: Tue May 05, 2009 3:07 pm
by craiglindley
Thanks that is what I wanted