char-socket: return -1 in case of disconnect during tcp_chr_write