delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/10/17/08:47:12

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() doesn't return error but crashes program
Date: Wed, 17 Oct 2001 12:46:22
Mime-Version: 1.0
Message-ID: <F84KenykohsyrYrZuvb000078c9@hotmail.com>
X-OriginalArrivalTime: 17 Oct 2001 12:46:23.0054 (UTC) FILETIME=[BA08B6E0:01C15709]

Helo all!

I'm doing some networking software for linux & windows using cygwin.

Now, I have a server that listens and accept() up to 10 different 
connections. The server is just a software tunnel, It just connects sockets 
from incoming calls to a default one in other machine.

In linux it woks fine, But in windows, there is a problem.

After a connection has been accepted, if the client aborts that connection 
when the remote host is trasmitting (client host receiving), when server 
write() to client host, the program crashes, even when write() is supposed 
to return -1 and set ERRNO.

The software looks like

if(FD_ISSET(remote host,rmask)) {
if((count=read(remote_sock,buffer,count)==-1) {
  perror("read");
  do_close_this_connection_and_free_stuff();
}
if((write(client_sock,buffer,count)==-1) { // It crashes here
  perror("write"); // this error never displayed
  do_close_this_connections_and_free_stuff();
}
}

In a command window (command.com), there is no error message and the program 
crashes

In a shell window (cygwin bash in windows), there is an error message:
(Broken pipe), but the program crashes too.

Is this a known (bug/unimplemented socket feature)?

Thanks 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