Back to project page android_opengles.
The source code is released under:
MIT License
If you think the Android project android_opengles listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.example.android.wifidirect.discovery; /* w w w . ja va2 s. c om*/ import android.os.Handler; import android.util.Log; import java.io.IOException; import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.Socket; public class ClientSocketHandler extends Thread { private static final String TAG = "ClientSocketHandler"; private Handler handler; private ChatManager chat; private InetAddress mAddress; public ClientSocketHandler(Handler handler, InetAddress groupOwnerAddress) { this.handler = handler; this.mAddress = groupOwnerAddress; } @Override public void run() { Socket socket = new Socket(); try { socket.bind(null); socket.connect(new InetSocketAddress(mAddress.getHostAddress(), WiFiServiceDiscoveryActivity.SERVER_PORT), 5000); Log.d(TAG, "Launching the I/O handler"); chat = new ChatManager(socket, handler); new Thread(chat).start(); } catch (IOException e) { e.printStackTrace(); try { socket.close(); } catch (IOException e1) { e1.printStackTrace(); } return; } } public ChatManager getChat() { return chat; } }