tcp_input_stream(?Socket, -Stream)Returns the input stream Stream from the socket file descriptor Socket. You can read from the stream using the regular stream input predicates.
If you attempt to read from a broken socket, the "Connection reset by peer" exception is raised:
existence_error(_,_,_,_,errno(54))
When using tcp_select/[1,2], this exception is caught and
interpreted as an end_of_file, and the connection is shut down.