开发者

java - TCP - checking for data through functions

开发者 https://www.devze.com 2023-03-22 10:39 出处:网络
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, bu

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 using gClient.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.

0

精彩评论

暂无评论...
验证码 换一张
取 消