gloomyandy wrote:What is it you are trying to do? There is no problem with having input and output streams open at the same time. What you can't do is have multiple connects over USB, or have one thread performing a read while another thread attempts to write to the device.
Yeah that's what I meant, reading and writing at the same time. I've written a little program that remote controls the NXT over USB and Bluetooth (which I'm actually quite proud of
here and
here). Writing works well but I wanted to be prepared for certain "emergency" situations on the NXT. For example if I shut down the NXT by catching a press of the escape key and shutting it down I want to tell the program on the PC do exit as well, but I can't do that because I have no possibility to receive anything from the NXT when I also want to be able to send to it at any given moment (ie remote control it from the PC).
gloomyandy wrote:This means you are pretty much limited to having one side send data and have the other side respond. I don't believe there is any way around this when using the Lego fantom driver driver, that is simply how it is.
Are there no other drivers for Windows that can be used to connect to the NXT?
gloomyandy wrote:[...] you could write your own USB driver for Windows/Mac and this would avoid the problem...
Ah, sadly I'm not yet that good

gloomyandy wrote:The fantom driver read function is basically a read with a fixed period timeout (approx 20 seconds I think). So probably the best that could be done would be to make the the low level devRead and devWrite calls synchronous. This would have the effect of allowing a write call to take place each time the fantom read call timed out. Which would allow a blocking read from one thread with a write call every 20 seconds or so from another thread. But this is not really a general purpose solution...
So pretty much read/write cyclus every 20s? That's not really practical for an application that should remote control the NXT ^^'
So I'm pretty much stuck with using Bluetooth if I want to read and write at the same time from windows...
Well at least now I'm sure it's not possible.
Thanks a lot

BTW, really nice how active you all are here and how fast you always help!
