Hi,Your program is doing what I would expect it to. Your PC program is writing 100 ints and then exiting which will close the connection, your NXT program is reading 100 ints, and is then looping round to read a further 100 ints (you have a while loop around the for loop the reads the ints), when it tries to read the 1st int in the second iteration of the for loop then it will find that the connection has been closed by the PC program and so will throw the EOF exception...

Ok, I understand your point in this case. But I still doubt that in the other program gets stuck reading, ie to reach the readInt () does nothing else, and he does not read data sent. And it's strange because the same code (other than the one submitted) worked well but not now.

Andy is correct about the program you posted in this thread. The NXT is trying to read more than 100 ints. Does the error still happen, if the NXT only reads 100 ints? Does the EOFException happen before the NXT has successfully read 100 ints?Or are you talking about another program/problem in your last post?

If you had code that worked before, then something has changed. Have you made any changes to either the PC or NXT code? If you can't work out what the problem is you need to step back and work out exactly what is happening. Check that you are actually sending the data (and flushing the streams), make sure that you are not issuing more reads than you think you are. We can't really help without more details of what is actually going wrong...

skoehler wrote:Andy is correct about the program you posted in this thread. The NXT is trying to read more than 100 ints. Does the error still happen, if the NXT only reads 100 ints? Does the EOFException happen before the NXT has successfully read 100 ints?Or are you talking about another program/problem in your last post?

gloomyandy wrote:» Hi,Your program is doing what I would expect it to. Your PC program is writing 100 ints and then exiting which will close the connection, your NXT program is reading 100 ints, and is then looping round to read a further 100 ints (you have a while loop around the for loop the reads the ints), when it tries to read the 1st int in the second iteration of the for loop then it will find that the connection has been closed by the PC program and so will throw the EOF exception...

the error in the case expressed the exception occurs before reading. The code is equal to previous work, no changes have been made ​​either in or on the PC. Changed Brick thinking the problem could go there but stayed the same. In the case of my program does not throw any error, it just comes to readInt () and no action. But if you send messages to your PC.

Hi, as I've already said without more information we can't really help. Are you sending data to the PC? Your test program does not do that. Try making your test program more like your actual program until you can reproduce the actual problem. Then post that code here.

gloomyandy wrote:Hi, as I've already said without more information we can't really help. Are you sending data to the PC? Your test program does not do that. Try making your test program more like your actual program until you can reproduce the actual problem. Then post that code here.

Good luck

Andy

My test program represents my real program, only the test throws me an exception, and the other nothing, it just sticks in RedINT (), without any kind of action. I honestly do not know what else to read, send achievement information but not read.

We have already explained that the exception in your test program is to be expected basically your test program has a programming error in it. Try removing the line "while(!Button.ESCAPE.isDown())" and it should work without throwing the exception.

Without more information about the actual problem there is nothing more we can do to help. Clearly since your test program does not reproduce the problem in your actual program there must be some differences. All I can suggest is that you try making the test program more like your actual program...

nikita190 wrote:... and the other nothing, it just sticks in RedINT (), without any kind of action.

The readInt() method waits until the other side (in this case the program on the PC) writes 4 bytes. Is it possible, that you don't understand the concept of blocking I/O as implemented by the DataInputStream class?If you want to do other stuff in parallel to waiting for data to arrive, then you have to use Threads.