This is the mail archive of the
cygwin@cygwin.com
mailing list for the Cygwin project.
write() doesn't return error but crashes program
- To: cygwin at cygwin dot com
- Subject: write() doesn't return error but crashes program
- From: "Miguelanxo Otero" <miguelanxotero at hotmail dot com>
- Date: Wed, 17 Oct 2001 12:46:22
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/