我在服务器上使用Socket.io(1.0.4)和node.js,在Android客户端上使用AndroidAsync(https://github.com/koush/AndroidAsync)。
连接时我收到无效的int错误。我是socket.io的新手,请帮我纠正这个错误。
> 06-08 23:13:15.304: I/SensorManager(25557): Set normal delay = true
> 06-08 23:13:16.165: I/Socket.IO(25557): (0 ms)
> http://192.168.1.3:3000/socket.io/1/: Reconnecting socket.io 06-08
> 23:13:16.175: D/Socket.IO(25557): (9 ms)
> http://192.168.1.3:3000/socket.io/1/: Executing request. 06-08
> 23:13:16.205: D/Socket.IO(25557): (38 ms)
> http://192.168.1.3:3000/socket.io/1/: Connecting socket 06-08
> 23:13:16.295: D/SensorManager(25557): registerListener :: handle = 4
> name= BMA222 3-axis Accelerometer delay= 200000 Trklfufi 9
> budiwrd5mrfo5WirfulblrwuFmfulTrklfufi$KfukwiFmfulTrklfufiRvht@,*8e8-*(
> 06-08 23:13:19.378: V/Socket.IO(25557): (3204 ms)
> http://192.168.1.3:3000/socket.io/1/: socket connected 06-08
> 23:13:19.378: V/Socket.IO(25557): (3205 ms)
> http://192.168.1.3:3000/socket.io/1/: 06-08 23:13:19.378:
> V/Socket.IO(25557): POST /socket.io/1/ HTTP/1.1 06-08 23:13:19.378:
> V/Socket.IO(25557): Host: 192.168.1.3:3000 06-08 23:13:19.378:
> V/Socket.IO(25557): User-Agent: Dalvik/1.6.0 (Linux; U; Android 4.1.2;
> GT-I9070 Build/JZO54K) 06-08 23:13:19.378: V/Socket.IO(25557):
> Accept-Encoding: gzip, deflate 06-08 23:13:19.378: V/Socket.IO(25557):
> Connection: keep-alive 06-08 23:13:19.378: V/Socket.IO(25557): Accept:
> */* 06-08 23:13:19.378: V/Socket.IO(25557): 06-08 23:13:19.378: V/Socket.IO(25557): (3205 ms) http://192.168.1.3:3000/socket.io/1/:
> request completed 06-08 23:13:19.398: V/Socket.IO(25557): (3223 ms)
> http://192.168.1.3:3000/socket.io/1/: Received headers: 06-08
> 23:13:19.398: V/Socket.IO(25557): HTTP/1.1 400 Bad Request 06-08
> 23:13:19.398: V/Socket.IO(25557): Content-Type: application/json 06-08
> 23:13:19.398: V/Socket.IO(25557): Date: Tue, 08 Jul 2014 17:42:54 GMT
> 06-08 23:13:19.398: V/Socket.IO(25557): Connection: keep-alive 06-08
> 23:13:19.398: V/Socket.IO(25557): Transfer-Encoding: chunked 06-08
> 23:13:19.398: V/Socket.IO(25557): 06-08 23:13:19.398:
> V/Socket.IO(25557): (3223 ms) http://192.168.1.3:3000/socket.io/1/:
> Final (post cache response) headers: 06-08 23:13:19.398:
> V/Socket.IO(25557): HTTP/1.1 400 Bad Request 06-08 23:13:19.398:
> V/Socket.IO(25557): Content-Type: application/json 06-08 23:13:19.398:
> V/Socket.IO(25557): Date: Tue, 08 Jul 2014 17:42:54 GMT 06-08
> 23:13:19.398: V/Socket.IO(25557): Connection: keep-alive 06-08
> 23:13:19.398: V/Socket.IO(25557): Transfer-Encoding: chunked 06-08
> 23:13:19.398: V/Socket.IO(25557): 06-08 23:13:19.398:
> D/Socket.IO(25557): (3223 ms) http://192.168.1.3:3000/socket.io/1/:
> Connection successful 06-08 23:13:19.408: D/Socket.IO(25557): (3240
> ms) http://192.168.1.3:3000/socket.io/1/: Recycling keep-alive socket
> 06-08 23:13:19.408: E/Socket.IO(25557): (3240 ms)
> http://192.168.1.3:3000/socket.io/1/: socket.io disconnected 06-08
> 23:13:19.468: E/Socket.IO(25557): Invalid int: "0,"message"" 06-08
> 23:13:19.468: E/Socket.IO(25557): java.lang.NumberFormatException:
> Invalid int: "0,"message"" 06-08 23:13:19.468: E/Socket.IO(25557): at
> java.lang.Integer.invalidInt(Integer.java:138) 06-08 23:13:19.468:
> E/Socket.IO(25557): at java.lang.Integer.parse(Integer.java:375)
> 06-08 23:13:19.468: E/Socket.IO(25557): at
> java.lang.Integer.parseInt(Integer.java:366) 06-08 23:13:19.468:
> E/Socket.IO(25557): at java.lang.Integer.parseInt(Integer.java:332)
> 06-08 23:13:19.468: E/Socket.IO(25557): at
> com.koushikdutta.async.http.socketio.SocketIOConnection$2.transform(SocketIOConnection.java:114)
> 06-08 23:13:19.468: E/Socket.IO(25557): at
> com.koushikdutta.async.http.socketio.SocketIOConnection$2.transform(SocketIOConnection.java:108)
> 06-08 23:13:19.468: E/Socket.IO(25557): at
> com.koushikdutta.async.future.TransformFuture.onCompleted(TransformFuture.java:14)
> 06-08 23:13:19.468: E/Socket.IO(25557): at
> com.koushikdutta.async.future.SimpleFuture.handleCallbackUnlocked(SimpleFuture.java:96)
> 06-08 23:13:19.468: E/Socket.IO(25557): at
> com.koushikdutta.async.future.SimpleFuture.setComplete(SimpleFuture.java:130)
> 06-08 23:13:19.468: E/Socket.IO(25557): at
> com.koushikdutta.async.future.SimpleFuture.setComplete(SimpleFuture.java:117)
> 06-08 23:13:19.468: E/Socket.IO(25557): at
> com.koushikdutta.async.http.AsyncHttpClient.invokeWithAffinity(AsyncHttpClient.java:432)
> 06-08 23:13:19.468: E/Socket.IO(25557): at
> com.koushikdutta.async.http.AsyncHttpClient.access$600(AsyncHttpClient.java:44)
> 06-08 23:13:19.468: E/Socket.IO(25557): at
> com.koushikdutta.async.http.AsyncHttpClient$4.run(AsyncHttpClient.java:443)
> 06-08 23:13:19.468: E/Socket.IO(25557): at
> com.koushikdutta.async.AsyncServer.lockAndRunQueue(AsyncServer.java:675)
> 06-08 23:13:19.468: E/Socket.IO(25557): at
> com.koushikdutta.async.AsyncServer.runLoop(AsyncServer.java:692) 06-08
> 23:13:19.468: E/Socket.IO(25557): at
> com.koushikdutta.async.AsyncServer.run(AsyncServer.java:600) 06-08
> 23:13:19.468: E/Socket.IO(25557): at
> com.koushikdutta.async.AsyncServer.access$700(AsyncServer.java:37)
> 06-08 23:13:19.468: E/Socket.IO(25557): at
> com.koushikdutta.async.AsyncServer$13.run(AsyncServer.java:549) 06-08
> 23:13:19.468: W/System.err(25557): java.lang.NumberFormatException:
> Invalid int: "0,"message"" 06-08 23:13:19.468: W/System.err(25557):
> at java.lang.Integer.invalidInt(Integer.java:138) 06-08 23:13:19.478:
> W/System.err(25557): at java.lang.Integer.parse(Integer.java:375)
> 06-08 23:13:19.478: W/System.err(25557): at
> java.lang.Integer.parseInt(Integer.java:366) 06-08 23:13:19.478:
> W/System.err(25557): at java.lang.Integer.parseInt(Integer.java:332)
> 06-08 23:13:19.478: W/System.err(25557): at
> com.koushikdutta.async.http.socketio.SocketIOConnection$2.transform(SocketIOConnection.java:114)
> 06-08 23:13:19.478: W/System.err(25557): at
> com.koushikdutta.async.http.socketio.SocketIOConnection$2.transform(SocketIOConnection.java:108)
> 06-08 23:13:19.478: W/System.err(25557): at
> com.koushikdutta.async.future.TransformFuture.onCompleted(TransformFuture.java:14)
> 06-08 23:13:19.478: W/System.err(25557): at
> com.koushikdutta.async.future.SimpleFuture.handleCallbackUnlocked(SimpleFuture.java:96)
> 06-08 23:13:19.478: W/System.err(25557): at
> com.koushikdutta.async.future.SimpleFuture.setComplete(SimpleFuture.java:130)
> 06-08 23:13:19.478: W/System.err(25557): at
> com.koushikdutta.async.future.SimpleFuture.setComplete(SimpleFuture.java:117)
> 06-08 23:13:19.478: W/System.err(25557): at
> com.koushikdutta.async.http.AsyncHttpClient.invokeWithAffinity(AsyncHttpClient.java:432)
> 06-08 23:13:19.478: W/System.err(25557): at
> com.koushikdutta.async.http.AsyncHttpClient.access$600(AsyncHttpClient.java:44)
> 06-08 23:13:19.488: W/System.err(25557): at
> com.koushikdutta.async.http.AsyncHttpClient$4.run(AsyncHttpClient.java:443)
> 06-08 23:13:19.488: W/System.err(25557): at
> com.koushikdutta.async.AsyncServer.lockAndRunQueue(AsyncServer.java:675)
> 06-08 23:13:19.498: W/System.err(25557): at
> com.koushikdutta.async.AsyncServer.runLoop(AsyncServer.java:692) 06-08
> 23:13:19.498: W/System.err(25557): at
> com.koushikdutta.async.AsyncServer.run(AsyncServer.java:600) 06-08
> 23:13:19.498: W/System.err(25557): at
> com.koushikdutta.async.AsyncServer.access$700(AsyncServer.java:37)
> 06-08 23:13:19.498: W/System.err(25557): at
> com.koushikdutta.async.AsyncServer$13.run(AsyncServer.java:549)