我正在尝试连接在端口3000上运行的nodejs群聊应用程序,我在我的项目中使用socket.io-client:0.7.0库。它没有连接到服务器。 我按照本教程
http://socket.io/blog/native-socket-io-and-android/
package com.github.nkzawa.socketio.androidchat;
import android.app.Application;
import java.net.URISyntaxException;
import io.socket.client.IO;
import io.socket.client.Socket;
public class ChatApplication extends Application {
private Socket mSocket;
{
try {
IO.Options options = new IO.Options();
options.port = 3000;
mSocket = IO.socket("http://192.168.0.101",options);
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
}
public Socket getSocket() {
return mSocket;
}
}