我刚刚写了一个连接wifi的应用程序如下:
wifi.setWifiEnabled(false);
wifi.setWifiEnabled(true);
int res = wifi.addNetwork(wificonfigurationA);
boolean b = false;
b = wifi.enableNetwork(res, true);
Log.d("WifiPreference", "enableNetwork returned " + b);
Socket socket = new Socket(serverAddr, 3000);
PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())), true);
out.println("Hey Server!");
这给出了01-02 00:03:36.882: E/ClientActivity(1550): java.net.ConnectException: /10.10.2.200:3000 - Network is unreachable
错误。请帮忙