码迷,mamicode.com
首页 > 其他好文 > 详细

PG_RMAN使用手册

时间:2020-08-10 09:30:37      阅读:82      评论:0      收藏:0      [点我收藏+]

标签:srv   over   安装软件   命令   设置   pre   his   tmp   archive   

Boblim   Android中判断网络连接是否可用及监控网络状态     https://www.cnblogs.com/fnlingnzb-learner/p/7531811.html 

LAN/WAN/WLAN/WWAN区别总结  https://blog.csdn.net/wenlong199/article/details/104521107

 

一.LAN/WAN/WLAN/WWAN区别总结
LAN: Local Area Network : 局域网
WAN: Wide Area Network, 广域网
WLAN: Wireless LAN, 无线局域网
WWAN: Wireless WAN: 无线广域网

二.以太网监听广播

2.1.AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.gatsby.networktest"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="22"
        android:targetSdkVersion="22" />

    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
    <uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
    <uses-permission android:name="android.permission.INTERNET" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <receiver android:name=".MyBroadcast" >
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
                <action android:name="android.net.wifi.STATE_CHANGE" />
                <action android:name="android.Net.wifi.WIFI_STATE_CHANGED" />
                <!-- 网络更改广播 -->
                <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
            </intent-filter>
        </receiver>

        <service android:name=".NetworkService" >
        </service>
    </application>

</manifest>

2.2.MyBroadcast.java

package com.gatsby.networktest;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.util.Log;

public class MyBroadcast extends BroadcastReceiver {

	static final String BOOT_COMPLETED = "android.intent.action.BOOT_COMPLETED";
	public int NET_ETHERNET = 1;
	public int NET_WIFI = 2;
	public int NET_NOCONNECT = 0;

	@Override
	public void onReceive(Context context, Intent intent) {
		// TODO Auto-generated method stub

		String action = intent.getAction();

		if (action.equals(BOOT_COMPLETED)) {
			Intent startService = new Intent(context, NetworkService.class);
			Log.d("gatsby", "BOOT_COMPLETED Broadcast-----------!!!!");
			context.startService(startService);
		} else if (action.equals(ConnectivityManager.CONNECTIVITY_ACTION)
				|| action.equals("android.net.conn.CONNECTIVITY_CHANGE")) {

			switch (isNetworkAvailable(context)) {
			case 1:
				Log.d("gatsby", "-----------networktest---------ethernetState");
				Intent etherIntent = new Intent();
				etherIntent.setAction("com.xinhua.etherIntent");
				context.sendBroadcast(etherIntent);

				break;
			case 2:
				Log.d("gatsby", "-----------networktest---------wifinetState");
				Intent wifiIntent = new Intent();
				wifiIntent.setAction("com.xinhua.wifiIntent");
				context.sendBroadcast(wifiIntent);
				break;
			case 0:
				Log.d("gatsby", "-----------networktest---------NONO");

				break;
			default:
				break;
			}
		}

	}

	private int isNetworkAvailable(Context mcontext) {
		ConnectivityManager connectMgr = (ConnectivityManager) mcontext.getSystemService(Context.CONNECTIVITY_SERVICE);
		NetworkInfo ethNetInfo = connectMgr.getNetworkInfo(ConnectivityManager.TYPE_ETHERNET);
		NetworkInfo wifiNetInfo = connectMgr.getNetworkInfo(ConnectivityManager.TYPE_WIFI);

		if (ethNetInfo != null && ethNetInfo.isConnected()) {
			return NET_ETHERNET;
		} else if (wifiNetInfo != null && wifiNetInfo.isConnected()) {
			return NET_WIFI;
		} else {
			return NET_NOCONNECT;
		}
	}

}

 三.节点判断以太网插拔状态   cat /sys/class/net/eth0/carrier

四.ping 外网  

	public static final boolean ping() {

		String result = null;
		try {
			String ip = "www.baidu.com";
			Process p = Runtime.getRuntime().exec("ping -c 3 -w 100 " + ip);
			int status = p.waitFor();
			if (status == 0) {
				result = "success";
				return true;
			} else {
				result = "failed";
			}
		} catch (IOException e) {
			result = "IOException";
		} catch (InterruptedException e) {
			result = "InterruptedException";
		} finally {
			Log.d("gatsby", " ping result = " + result);
		}
		return false;
	}

  

 

 

PG_RMAN使用手册

标签:srv   over   安装软件   命令   设置   pre   his   tmp   archive   

原文地址:https://blog.51cto.com/candon123/2518386

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!