| delorie.com/archives/browse.cgi | search |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sources.redhat.com/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT com |
| From: | =?iso-8859-2?B?UGlvdHIgU3TqcGll8Q==?= <pstepien AT aspco DOT com DOT pl> |
| To: | <cygwin AT cygwin DOT com> |
| Subject: | recvfrom and timeout signal |
| Date: | Tue, 19 Feb 2002 22:28:02 +0100 |
| Message-ID: | <LPBBKFLLCCLABNJIKJOGKELLGOAA.pstepien@aspco.com.pl> |
| MIME-Version: | 1.0 |
| X-Priority: | 3 (Normal) |
| X-MSMail-Priority: | Normal |
| X-Mailer: | Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) |
| X-MimeOLE: | Produced By Microsoft MimeOLE V5.00.2314.1300 |
| Importance: | Normal |
Hi All,
I try to implement timeout for recvfrom:
struct sigaction action;
action.sa_handler = alarm_signal;
action.sa_flags = 0;
sigemptyset(&(action.sa_mask)); /* ignore all known signals */
sigaction(SIGALRM,&action,NULL); /* ensures that SA_RESTART is NOT set */
alarm(TIMEOUT);
int st=recvfrom(sockfd,buff,sizeof(buff),0,(sockaddr*)&srv_addr,&sz);
if(st == -1){
if(errno==EINTR){
/* timeout */
}else{
alarm(0); /* reset alarm */
}
}
but the process is never woken by SIGALRM when no packet is received.
The recvfrom waits forever.
Has anybody an idea what can be wrong ?
--
Piotr Stepien
--
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/
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |