• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

java Socket error  RSS feed

 
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.
 
Saloon Keeper
Posts: 4749
117
  • 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
 
Master Rancher
Posts: 3630
40
  • 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
Saloon Keeper
Posts: 4749
117
  • 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.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!