zl程序教程

您现在的位置是:首页 >  移动开发

当前栏目

Android 10.0 以太网设置默认静态ip地址

Android静态地址IP 设置 默认 10.0 以太网
2023-09-14 09:14:22 时间

1.概述

在进行以太网产品开发的过程中,有功能要求设置默认静态ip地址的功能,不使用动态ip,方便ip地址管理所以就需要熟悉以太网的ip设置流程,然后设置对应的ip地址就可以了

2.以太网设置默认静态ip地址的相关代码

  frameworks\opt\net\ethernet\java\com\android\server\ethernet\EthernetServiceImpl.java
  frameworks\opt\net\ethernet\java\com\android\server\ethernet\EthernetService.java
  frameworks\opt\net\ethernet\java\com\android\server\ethernet\EthernetConfigStore.java

3.以太网设置默认静态ip地址的功能分析和实现

3.1 EthernetService.java以太网服务的功能分析

    import android.content.Context;
import android.util.Log;
import com.android.server.SystemService;

public final class EthernetService extends SystemService {

    private static final String TAG = "EthernetService";
    final EthernetServiceImpl mImpl;

    public EthernetService(Con