| delorie.com/archives/browse.cgi | search |
| Mailing-List: | contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm |
| List-Subscribe: | <mailto:cygwin-subscribe AT sources DOT redhat DOT com> |
| List-Archive: | <http://sources.redhat.com/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT sources DOT redhat DOT com> |
| List-Help: | <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs> |
| 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" <miguelanxotero AT hotmail DOT com> |
| 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 |
| 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/
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |