Hello together,

I am trying to let my computer communicate with a NXT during runtime. That 
means 
that I start a program on the NXT and I am listening for incoming bluetooth 
connections. My computer connects to the NXT and writes a file into the flash 
memory. Everything works fine. But when I try to read the just written file, I 
get an IOException on my computer with the message "Read failed: Connection 
reset by peer (104)".

This is the code for reading the file on the computer's side:

    File result = new File( localFileName );
    FileInfo fi = new FileInfo( remoteFileName );
    
    try
    {
      fi = NXTComm.openRead( remoteFileName );
    }
    catch ( IOException e )
    {
      System.err.println( remoteFileName );
      System.err.println( e.getMessage() );
    }
    byte content[] = NXTComm.readFile( fi.fileHandle, fi.fileSize );
    
    FileWriter fw = new FileWriter( result, false );
    fw.write( new String( content ) );
    fw.close();
    
    return result;

After writing to the file, I properly close it (Error code 0 = success), but as 
soon as I start reading, I get this IOException.

If this is a bug, is there some kind of workaround?

Thank you for your help

Greetings

JOHANNES


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Lejos-discussion mailing list
Lejos-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lejos-discussion

Reply via email to