www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2016/08/15/14:34:51

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:from:date:message-id:subject:to
:content-type; q=dns; s=default; b=bG5Tvci8z8uxeEy6v4UfzSZ/pAMs0
9PSyTmJLy0Pj8EX1XM227CO1FkD7jBEte8gsCZNkHr4TXP7WI48jiBkdutZuLEtS
1RYIh9FvzCIL3wUnm1Nv4hMHg0n5B9W9SNqs3yhCM0JVhWC7Rmal9LcoLNX4r/jN
P3i8SwXb7ql5c8=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:from:date:message-id:subject:to
:content-type; s=default; bh=hfIQhSUn34zw5Q73OfPLV5h9kI0=; b=c68
v4yYNUm1wufMQ/zWNTtqVqb0WGYnNqdIoUhITr2SR/Sxs28h+uaV0mc0J7NImtai
7ilAK1ssRhvcG8EVuJykhPDj+HFDNSFLmRwuo2v3+Lvm20Ow0ZnoWQgAMRUPYGm4
gvUy7j3qRDzwFVCK04jSfi9n/ggP1mohKvxZSqEU=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=UD:It, Hx-languages-length:1132, browser
X-HELO: mail-it0-f47.google.com
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=XNbTWN49+TyQiRg1RM3AjgSAV6eI0pQrLg+VpKT6a8Y=; b=elYTka2JmDNaOJUevocKPI59cu8KH2cXqo4fNmIAUpphSV4ZLbZviuOpKFYtbjNdAk tZ7tlloU7PWUttSE8PjVrlfHr/NW+eqOsszD3sU0iavQEsKkEO5ByOi/8LDUXa9OBZcc RJv63T0EyOm/usMRmKkrR+2+Z7yfObZCm5h/tp0BHhxHQO0IeVair/ZSHr+LMcYfnJlj 9Rneg122ukmkIUwqZ/o+S9ptC2nLfRawBGc5WF7J5GuwSVwJjJ+7F6MYefRkxSQz8nt6 MLAl5tu6AzFupzKz2xbRx34E8MzHQaf+IGUIgn9XirMjU+oaH8r/zUiR0K5owtF+560u eKbQ==
X-Gm-Message-State: AEkoousdpNlHmPNF+vJsr5z4JYOw0LBwm2vfQLuBMD2pyP389p7pO6iBO2eoeDrggk/Y7QpSKpRhcdpLPND5LA==
X-Received: by 10.36.127.75 with SMTP id r72mr16084671itc.55.1471286063958; Mon, 15 Aug 2016 11:34:23 -0700 (PDT)
MIME-Version: 1.0
From: Pankaj Yadav <pankajdnapster AT gmail DOT com>
Date: Tue, 16 Aug 2016 00:04:23 +0530
Message-ID: <CAAPqxJx+EPpzESWMOXowp3grKubWJJ7n93ftFPK1L3MKWkqrLQ@mail.gmail.com>
Subject: On WIN7, write() not returning immediately even on non-blocking sockets
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes

Hi,
We have a proxy server type of program which has an infinite loop
writing to sockets with write() call.

All of the sockets are set to non-blocking mode.It works fine on linux
and all windows versions except win7(both 32 and 64 bit).We tested on
hundreds of computers.

The code where it gets stuck is

printf("Nonblocking:%d\n",(fcntl(t_qelem->respsock, F_GETFL, 0) &
O_NONBLOCK))?1:0;
i = write(t_qelem->respsock,&t_qelem->webtoresp[t_qelem->webtorespsent],t_qelem->webtoresplen-t_qelem->webtorespsent);
printf("written\n");

Output is :  Non-blocking:1 and then it does NOT print "written" ever.

I also tried to do some debugging using gdb.
write() -> send_internal()  ->{looping through fhandler_socket::wait_for_events}
even when the socket is set to blocking mode.

I am ignoring SIGPIPEs but I know that it probably happens only when
the connection has closed from the other side coz it happens when i
close the browser which is using this proxy software.Can you please
help me out, if i am doing something wrong.

Thanks
-- 
--
Regards
Pankaj Yadav

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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