Android的 - 如何保持与服务器长时间连接 [英] Android - How to keep connection with server for a long time

查看:160
本文介绍了Android的 - 如何保持与服务器长时间连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的SocketChannel写了一个聊天应用程序为Android。它与服务器和所有功能的工作成功连接。但自从我登录很长一段时间(约2-3小时)后,我再次尝试发送聊天信息和失败。在日志文件中,一个SocketChannel,选择仍处于打开状态并连接到服务器,消息已经写成功。有什么问题?我缺少什么?

I wrote a chat application for Android using SocketChannel. It connects successfully with the server and all features work. But after a long time since I logged in (about 2-3 hours), I try to send a chat message again and it fails. In log file, SocketChannel, selector still open and connect to server, message already write successful. What's the problem? What am I missing?

在此先感谢您的帮助。

推荐答案

如果您要创建Android或其他东西与从推送服务器的聊天室,与MQTT尝试

if you want to create a Chat for android or something else with push from a server, try it with MQTT

http://tokudu.com/2010/how -to-实施推的通知换的Andr​​oid /

它是一个非常酷的东西,只是来看看它: - )

its is a very cool thing, just take a look at it :-)

这篇关于Android的 - 如何保持与服务器长时间连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆