• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java Socket error

 
Mahesh Narayanan
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I having trouble running this code. This java class containing this code gets compiled into a jar and uploaded into another application and it runs within that. So I have limited debug capability. Please help.
 
Tim Moores
Bartender
Posts: 3129
50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What kind of trouble? Which parts of the code are or are not being executed? Any error messages?

Also read http://test.javaranch.com/ulf/apple-java-tech-notes/Tech%20Notes/tn1157.html - your code suffers from this by using "readLine()".
 
Mahesh Narayanan
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I modified the code a little bit. Now it runs for one iteration (i want to run in loop) and then gives a null pointer exception at line 80 (readline()). The other end is a vbscript code that pushes to this socket.

Edit: formatted code
 
Dave Tolls
Ranch Hand
Posts: 2095
15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might need to sort your indentation out.
It's hard to see the flow of the code.
Is there any other stack trace in your logs?
Because the only way that 'in' would be null was if there was an IOException earlier.
 
Tim Moores
Bartender
Posts: 3129
50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The error handling in this code is seriously defective - if there's a problem in line 13, the code should quit. If there's a problem in line 22, the code should quit. In both cases the code proceeds - that's not going to work.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic