lua-sockets: check socket state, simplify overall naming.