my dog learned polymorphism
The moose likes Beginning Java and the fly likes NullPointerException when writing to a socket. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "NullPointerException when writing to a socket." Watch "NullPointerException when writing to a socket." New topic
Author

NullPointerException when writing to a socket.

Chris Singer
Greenhorn

Joined: Nov 27, 2001
Posts: 15
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

Joined: Nov 27, 2001
Posts: 15
Discovered the reason the NullPointerException. Socket isn't connecting thus, writing to the Output Stream was throwing the NullPointerException.
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: NullPointerException when writing to a socket.
 
It's not a secret anymore!