java - TCP - checking for data through functions
i am trying to periodically check for objects via a function in a tcp client.
i am able to successfully receive the object if i check for it in the function that makes the connection to the server, but if i attempt the same re开发者_运维技巧ad usinggClient.getUpdate()
, i get a null pointer exception.
any advice is appreciated, thank you.
general program flow:
- main calls tcp client (server is running elsewhere)
- a loop in main continuously checks for a new object via a function in the client
- main updates an input mapping array based on the details of the new object
to clarify, getUpdate() is the function i wrote that checks for a new object
Maybe you're forgetting to save a reference to an object inside your client, during the connection phase. I'm just guessing here; your question should contain more info about your problem, such as a code snippet or stack trace.
精彩评论