Mailing-List: contact cygwin-help@sourceware.cygnus.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@sources.redhat.com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin@sources.redhat.com>
List-Help: <mailto:cygwin-help@sources.redhat.com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner@sources.redhat.com
Delivered-To: mailing list cygwin@sources.redhat.com
X-Originating-IP: [194.224.58.36]
From: "Miguelanxo Otero" <miguelanxotero@hotmail.com>
To: mcf@cobweb.com.au
Cc: cygwin@cygwin.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: <F265hu01WM2gMdhF7F30000bb73@hotmail.com>
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/

