This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: write() on closed socket crashes program instead of reporting error


At 09:44 AM 10/24/2001, Miguelanxo Otero wrote:
>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.


Have you tried 1.3.3 or a snapshot?  It would be quite helpful to know
if you have.  Sorry if I missed part of some previous thread here which
indicates that you have done this already.



Larry Hall                              lhall@rfk.com
RFK Partners, Inc.                      http://www.rfk.com
118 Washington Street                   (508) 893-9779 - RFK Office
Holliston, MA 01746                     (508) 893-9889 - FAX


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]