delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/10/24/09:48:24

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.37]
From: "Miguelanxo Otero" <miguelanxotero AT hotmail DOT com>
To: cygwin AT cygwin DOT com
Subject: write() on closed socket crashes program instead of reporting error
Date: Wed, 24 Oct 2001 13:44:06
Mime-Version: 1.0
Message-ID: <F5wlQdl3cadN7nU23pS000080f9@hotmail.com>
X-OriginalArrivalTime: 24 Oct 2001 13:44:06.0704 (UTC) FILETIME=[F36C0300:01C15C91]

Ok, this time i'll try to be very concise.

Im porting a linux application (a web server). The web server is able to 
manage different connections at a time (max 10 connections).

The problem is this... Imagine tou are downloading a page & in the middle of 
the download you kill (or press the stop button in) the web browser (client 
application). Then, if my web server tries to write() in the (closed | 
killed) socket, instead of reporting an error, the program crashes.

If i run my web server in the bash console of cygwin, it reports an "broken 
pipe" error after crashing.

If I run the web server in a ms-dos console, it dies silently.

the code is like this:

if ((count=write(client_socket,requested_web_page_buffer,length))==-1) {
perror("write");
free_stuff_of_this_connection();
}

In linux, if write fails, perror reports the error and the program frees 
connection & keeps running ok.

In windows (cygwin) if write fails, perror doesn't report anything & program 
crashes.

Im using cygwin1.dll version 1.3.2.

Tnx in advance.


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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019