Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

NativeMethodException Help  RSS feed

 
Billy Kim
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i'm working on a java client that will send numeric instructions to a server program coded in C through pipe files on Solaris 2.6. i'm able to write instructions through a pipe file to the server, the server will make its computations, and then the server should send back the results through a response pipe. the problem occurs when i try to send several requests to the server, after a few successful responses to the server back to the client, the client will hang randomly on the FileReader statement in the code below. but no exceptions are tripped to STDOUT. when i compiled with the jdb on, and i ran the jdb on the client class file, the "frin" object below had a com.sun.jdi.NativeMethodException associated with it. i'm not sure how to prevent the client from hanging. any suggestions? btw, we've also written the client code in C, and if we but a sleep(2) in right before the code below, the issue is resolved, yet with the Java client, it will ALWAYS fail on the FileReader statement in the code below.

try
{
FileReader frin =
new FileReader( "response.pipe");
BufferedReader bin = new BufferedReader( frin);

try
{
outputString = bin.readLine();
}
catch( IOException ioe3 )
{
System.out.println( "Error: " + ioe3 );
}
try
{
frin.close();
}
catch( IOException ioe4 )
{
System.out.println( "Error: " + ioe4 );
}
}
catch( FileNotFoundException fnfe2 )
{
System.out.println( "Error: " + fnfe2 );
}
System.out.println( outputString + "<-DONE" );
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!