From mboxrd@z Thu Jan 1 00:00:00 1970 References: <576D453F.4090208@gmail.com> From: Laurent LEQUIEVRE Message-ID: <576D4598.4080706@gmail.com> Date: Fri, 24 Jun 2016 16:37:12 +0200 MIME-Version: 1.0 In-Reply-To: <576D453F.4090208@gmail.com> Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Transfer-Encoding: 8bit Subject: Re: [Xenomai] socket XDDP recvfrom timeout ? List-Id: Discussions about the Xenomai project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: xenomai@xenomai.org, Laurent LEQUIEVRE forgot to specify : Xenomai 3.0.2 Le 24/06/2016 16:35, Laurent LEQUIEVRE a écrit : > Hello, > > I try to use the socket XDDP with the posix skin to communicate from > RT thread to non RT thread. > > To get a non blocked 'recvfrom', I added the flag 'MSG_DONTWAIT', and > it's work fine. > > But how to setup a timeout for this function ? > > I tried to set the flag 'SO_RCVTIEMO' by using 2 methods : > > struct timeval tv; > tv.tv_sec=nb seconds > tv.tv_usec=nb micro seconds > setsockopt(socket_id,SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)); --> > doesn't work, blocked ! > > timeout (in nano seonds) > ioctl(socket_id, SO_RCVTIMEO, &timeout); --> doesn't work, blocked ! > > > Thanks for your help, > > Laurent LEQUIEVRE > > >