
惯例,先简单介绍一下Websocket。
>这个你要和服务器端协商接口 然后在ios这边用线程或者nstimer来调用发送心跳的接口
/向服务器发送心跳包 sendHeartbeatPackage(mRestMsg); count += 1; } Threadsleep(1000 3); } catch (InterruptedException e)[java]
public class HeartbeatService extends Service implements Runnable
{
private Thread mThread;
public int count = 0;
private boolean isTip = true;
private static String mRestMsg;
private static String KEY_REST_MSG = "KEY_REST_MSG";
@Override
public void run()
{
while (true)
{
try
{
if (count > 1)
{
Logi("@qi", "offline");
count = 1;
if (isTip)
{
//判断应用是否在运行
ActivityManager am = (ActivityManager) getSystemService(ContextACTIVITY_SERVICE);
List<RunningTaskInfo> list = amgetRunningTasks(3);
for (RunningTaskInfo info : list)
{
if (infotopActivitygetPackageName()equals("orgyhndemo"))
{
//通知应用,显示提示“连接不到服务器”
Intent intent = new Intent("orgyhndemo");
intentputExtra("msg", true);
sendBroadcast(intent);
break;
}
}
isTip = false;
}
}
if (mRestMsg != "" && mRestMsg != null)
{
//向服务器发送心跳包
sendHeartbeatPackage(mRestMsg);
count += 1;
}
Threadsleep(1000 3);
}
catch (InterruptedException e)
{
eprintStackTrace();
}
}
}
private void sendHeartbeatPackage(String msg)
{
>观察指示灯颜色。dell服务器也是指戴尔服务器,服务器是比普通台式机更强大的计算机。dell服务器心跳指示灯中,指示灯是橙色灯,有可能是内存问题,也有可能是主板的问题,但主要的就是查看指示灯的颜色,这样才可准确的找出问题的所在。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)