Maneesh Godbole wrote:Surely there is more to the stack trace than you posted?
Maneesh Godbole wrote:Instead of polling, you might also want to consider Cloud Messaging
surlac surlacovich wrote:
Why the period of sending the message matters?
surlac surlacovich wrote:Thank you Henry!
But TCP is on Transport level, which should inherit "recoverability" (from Link layer maybe) and provide reliable connection. Is this right?
Henry Wong wrote:... in many cases, the endpoints can't figure it out until they actually try to send data.
surlac surlacovich wrote:Thanks Henry!
Henry Wong wrote:... in many cases, the endpoints can't figure it out until they actually try to send data.
So the best solution would be to handle exception and reopen the socket connection?
Henry Wong wrote:
Is reestablishing the socket even an option? If so, what are you even holding the socket open? Keeping a socket open, when you don't have to, so you can send a ping once in 24 hours is not very efficient, is it?
surlac surlacovich wrote:
Also after this exception is thrown and client creates new socket connection, somehow the new socket uses old output stream. Why this can happen?
surlac surlacovich wrote:Very good point. The socket connection keeps opened because:
1. server can push data to the client anytime
2. it's very hard to server to initiate connection (in my situation only client can initiate connection, thus server should notify client that it has data to send in case if socket connection is lost)
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Winston Gutkowski wrote:
Client establishes connection with server. Server checks if there is any data to be sent to client, and if so, sends it. No polling, no open connection, simple async comms.
surlac surlacovich wrote:OK, what if one turned off his laptop and go out where no Internet is available. At the same time server has urgent message to the client, so the server sends SMS/MMS/sends courier/etc. to let user know that he need to connect to the server via Internet and download the message. I mean this case involves a lot of overhead (think how long it will take to send SMS and initiate connection back to server, in comparison if we already connected to the server and can push data to the client), thus keeping the open Socket is justified solution.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Winston Gutkowski wrote:
No it isn't. If you don't have an Internet connection, you don't have one; if someone's laptop is turned off, it's turned off - and no amount of open sockets is going to get you the data any quicker.
Winston Gutkowski wrote:
What you might be able to do is have the client automatically initiate a connection whenever it detects a viable feed
surlac surlacovich wrote:That's right, when client got Internet it automatically connects to the server and keeps the connection opened.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
surlac surlacovich wrote:Winston, am I right that you consider sending notification to the client when both server and client has Internet but not connected to each other (and close the connection to release Socket right after the data received), is good solution?
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Winston Gutkowski wrote:
No. If both "ends" have a viable Internet connection, then presumably you can open a channel. Your problem is what to do when one end of that connection (presumably the client) is down.