Add check to prevent calling recv on a socket in the listening state. This
prevents a crash/hard fault when user code mistakenly tries to recv on the
listening socket instead of on the accepted connection.
Add corresponding test case to demonstrate the bug.
Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
If a port is not using internal error numbers, which match both lwIP and
Linux error numbers, ENTOCONN from standard libraries errno.h equals 128,
not 107.