Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com Message-ID: <38235657.48928E88@sls.lcs.mit.edu> Date: Fri, 05 Nov 1999 16:12:39 -0600 From: Nikko Strom Organization: MIT Lab for Computer Science X-Mailer: Mozilla 4.6 [en] (WinNT; U) X-Accept-Language: en MIME-Version: 1.0 To: cygwin AT sourceware DOT cygnus DOT com CC: nikko AT sls DOT lcs DOT mit DOT edu Subject: B20.1: socket functions always blocking? Content-Type: multipart/mixed; boundary="------------D49EDB122BE7E9757D06BAC1" --------------D49EDB122BE7E9757D06BAC1 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit In the attached example, I expected recv to be non-blocking. In fact, it seems like all socket functions always block! Help, please... I'm running cygwin Beta 20.1 on Win NT 4.0. Please respond by e-mail in addition to posting on the list if possible. Regards, Nikko Strom --------------D49EDB122BE7E9757D06BAC1 Content-Type: application/x-unknown-content-type-cfile; name="cygsockettest.c" Content-Transfer-Encoding: base64 Content-Disposition: inline; filename="cygsockettest.c" LyogdGVzdCBwcm9ncmFtLCBjeWd3aW4gQmV0YSAyMC4xLCBOVCA0LjANCiAqDQogKiB3aHkg aXMgcmVjdiBibG9ja2luZz8gDQogKi8NCg0KI2luY2x1ZGUgPHN0ZGlvLmg+DQojaW5jbHVk ZSA8c3RkbGliLmg+DQojaW5jbHVkZSA8dW5pc3RkLmg+DQoNCiNpbmNsdWRlIDxzeXMvaW9j dGwuaD4NCiNpbmNsdWRlIDxzeXMvdGltZS5oPg0KI2luY2x1ZGUgPHN5cy9zb2NrZXQuaD4N CiNpbmNsdWRlIDxzeXMvdHlwZXMuaD4NCg0KI2luY2x1ZGUgPG5ldGluZXQvaW4uaD4NCiNp bmNsdWRlIDxhcnBhL2luZXQuaD4NCiNpbmNsdWRlIDxuZXRkYi5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VURkwsIGZsYWdz KTsNCiAgICAgIGlmIChyZXMgPCAwKSB7cHJpbnRmKCIlZFxuIiwgX19MSU5FX18pOyBleGl0 KC0xKTt9DQoNCiAgICAgIHByaW50ZigiUzogQ29ubmVjdGVkXG4iKTsgZmZsdXNoKHN0ZG91 dCk7DQogICAgICANCiAgICAgIHNsZWVwKDEpOw0KICAgICAgDQogICAgICBwcmludGYoIlM6 IENhbGxpbmcgcmVjdlxuIik7IGZmbHVzaChzdGRvdXQpOw0KICAgICAgcmVzID0gcmVjdihz LCBidWYsIDEwLCAwKTsNCiAgICAgIHByaW50ZigiUzogQWZ0ZXIgcmVjdlxuIiwgcmVzLCBi dWYpOyBmZmx1c2goc3Rkb3V0KTsNCg0KICAgICAgaWYgKHJlcyA+IDApIHsNCglidWZbcmVz XSA9ICdcMCc7DQoJcHJpbnRmKCJTOiAlZCBjaGFyJ3MsIDwlcz4pXG4iLCByZXMsIGJ1Zik7 IGZmbHVzaChzdGRvdXQpOw0KICAgICAgfQ0KICAgICAgZWxzZSBwcmludGYoIlM6IHJlY3Yg cmV0dXJuZWQgJWRcbiIsIHJlcyk7IGZmbHVzaChzdGRvdXQpOw0KDQogICAgICBjbG9zZShz KTsNCiAgICAgIGNsb3NlKHNlcnYpOw0KDQogICAgICBicmVhazsNCiAgICB9DQogICAgZWxz ZSB7DQogICAgICBzbGVlcCgxKTsNCiAgICB9DQogIH0NCiAgc2xlZXAoNSk7DQp9DQoNCg0K bWFpbigpIHsNCiAgaW50IHBpZCA9IGZvcmsoKTsNCiAgaWYgKHBpZCkgc2VydmVyX3Byb2Mo KTsNCiAgZWxzZSBjbGllbnRfcHJvYygpOw0KfQ0KDQoNCg== --------------D49EDB122BE7E9757D06BAC1 Content-Type: text/plain; charset=us-ascii -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com --------------D49EDB122BE7E9757D06BAC1--