Subject: Re: write() doesn't return error but crashes program
From: "Miguelanxo Otero" <[email-masked]>
To: [email-masked]
Cc: [email-masked]
Date: Thu, 18 Oct 2001 12:28:35

>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/