Hi Dennis,

I have just detected the very same effect. At least with RTAI-3.3cv it is not 
working.
In rtnet's rt_udp_recvmsg()
the timeout will be set to -1 if the flag MSG_DONTWAIT is used.

The call to rtdm_sem_timeddown() with this timeout value fails as the resulting 
RTAI
function _sem_wait_timed rejects a negative timeout => it returns -EWOULDBLOCK 
immediately
without checking the semaphores value.
RTDM in RTAI seems not to handle a polling semaphore check correctly.
That means the only possible way (without changing rtdm) is to it the way you 
have done it:
Using a extreme small timeout value (=1).

By looking at the code I saw same strange things:
In rtnet, the time type nanosecs_t is a uint64, however in RTAI's rtdm the 
timetype is a signed int64.
That could lead to confusion...

To fix the MSG_DONTWAIT issue I have detected, the code can be modified to set 
the timeout
to 1 (instead of -1) whenever MSG_DONTWAIT is specified.

Regards

Mathias

----- Original Nachricht ----
Von:     Dennis Windisch <[EMAIL PROTECTED]>
An:      rtnet-users@lists.sourceforge.net
Datum:   24.08.2006 12:46
Betreff: [RTnet-users] Non-blocking sockets - possible bug?

> I've encountered the following problem setting RTnet sockets into non
> blocking mode:
> 
> > long long timeout = -1;
> > int res = ioctl_rt(socket,RTNET_RTIOC_TIMEOUT,&timeout);
> When setting the socket like above (non-blocking mode) nothing works,
> meaning there is no data is received via this socket. 
> 
> > long long timeout = 1;
> > int res = ioctl_rt(socket,RTNET_RTIOC_TIMEOUT,&timeout);
> But when I set the socket like above (note that timeout is no positive), the
> socket is set to blocking mode (yet only for a very small time) and all
> works fine, data gets received. 
> 
> I'm using RTAI 3.3, latest stable version form rtai.org (no CVS version)
> and RTnet 0.9.4 from rtnet.org (no SVN version).
> 
> Could it be I found a bug in setting sockets non-blocking?
> -- 
> 
> 
> Echte DSL-Flatrate dauerhaft für 0,- Euro*. Nur noch kurze Zeit!
> "Feel free" mit GMX DSL: http://www.gmx.net/de/go/dsl
> 
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> RTnet-users mailing list
> RTnet-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rtnet-users
> 

-- 
Mathias Koehrer
[EMAIL PROTECTED]


Viel oder wenig? Schnell oder langsam? Unbegrenzt surfen + telefonieren
ohne Zeit- und Volumenbegrenzung? DAS TOP ANGEBOT JETZT bei Arcor: günstig
und schnell mit DSL - das All-Inclusive-Paket für clevere Doppel-Sparer,
nur  44,85 €  inkl. DSL- und ISDN-Grundgebühr!
http://www.arcor.de/rd/emf-dsl-2

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
RTnet-users mailing list
RTnet-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rtnet-users

Reply via email to