socket client 简易封装:AndroidSocketClient

浏览: 78 发布日期: 2016-09-05 分类: android

socket client 简易封装

导入

JitPack

Add it in your project's build.gradle at the end of repositories:

repositories { // ... maven { url "https://jitpack.io" }
}

Step 2. Add the dependency in the form

dependencies {
  compile 'com.github.vilyever:AndroidSocketClient:1.0.1' }

用法

VDSocketClient socketClient = new VDSocketClient();
socketClient.registerDelegate(new VDSocketClient.VDSocketClientDelegate() {
    @Override
    public void didConnectFromSocketClient(VDSocketClient client) {

    }

    @Override
    public void didDisconnectFromSocketClient(VDSocketClient client) {

    }

    @Override
    public void didReceiveResponseFromSocketClient(VDSocketClient client, String response) {

    }
});
socketClient.connect("192.168.1.1", 80);

项目主页:http://www.open-open.com/lib/view/home/1442471175446

返回顶部