• Post Reply Bookmark Topic Watch Topic
  • New Topic

NullPointerException when writing to a socket.  RSS feed

 
Chris Singer
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone see why I would be getting a NullPointerException from the write command I'm making in the sendCommand method? I have checked the byte array to see that the values are truly there. I can't see why I would be getting a NullPointerException at run time from this line. Perhaps there is something I didn't initialize in the constructor? Does anyone have any suggestions. Thank you.
Chris

 
Chris Singer
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Discovered the reason the NullPointerException. Socket isn't connecting thus, writing to the Output Stream was throwing the NullPointerException.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!