Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com X-Originating-IP: [194.224.58.36] From: "Miguelanxo Otero" To: mcf AT cobweb DOT com DOT au Cc: cygwin AT cygwin DOT com Subject: Re: write() doesn't return error but crashes program Date: Thu, 18 Oct 2001 12:28:35 Mime-Version: 1.0 Content-Type: text/plain; format=flowed Message-ID: X-OriginalArrivalTime: 18 Oct 2001 12:28:35.0402 (UTC) FILETIME=[6813B2A0:01C157D0] >A file already open, or an attempt to write to a file not open will cause >an error. Ok. Thats how it's expected to be. Just an error (reported by perror("write"); ) but NOT a crash! I can't see from your example how can I guard the code for my program... When a client makes a connection, it's always open until client or server closes the conection. But there are different connections (up to 10) active at a time. The program doensn' follow an strict open->read|write->close->open->read|write>close sequence. It's more like while(1) { pool request socket; if(new_connection) accept(new_connection,socket_origin[number]); for(n=0;n<10;n++) { if(socket_origin[n] is ready to read) { read socket_origin[n]; write(socket_destiny[n]);//this may fail(report error),BUT NO CRASH! . . . I followed Sun's Network programing guide and my program is straight from the examples. It's not an unusual or bizarre style. _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/