Update netutils.c

Return an encoded state rather than an explicit state if a connection failed.