This week's book giveaway is in the Cloud forum.
We're giving away four copies of The Business Blockchain and have William Mougayar on-line!
See this thread for details.
Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Input-Stream closes with End-Of-Stream character

 
Abdullah Khan
Greenhorn
Posts: 3
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,
I am facing an issue with Socket Programming in a Android App.
I face a problem while receiving the data from the socket connection's input stream. The problem is :
From the socket connection that is opened, I obtain the input-Stream, and parse the data whenever it is available.

Like this:

And like this:

However, this input-stream then closes with a end-of-stream character (-1) if there is no data sent for a long time(~3 mins) from the remote-server.
Due to this input-stream closure, I am no longer able to receive the data that is sent by the server later.
I have debugged it and found the socket-connection is still open, and also the remote-server is broadcasting data (since it is a broadcast, the data
could be sent at any time, with very small to very big time gaps in between data signals)

Can you please advise me in overcoming this issue, such that the android application can parse the data which could be broadcasted by the remote-server at
any point of time.
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried changing the timeout on the socket ?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic