【发布时间】:2017-11-09 07:50:28
【问题描述】:
在我的应用程序中,我使用套接字与另一个设备进行通信。我一直有一个 SocketTimeoutException 。我在服务中所做的这种沟通
这是一个日志:
11-09 08:44:05.029 5458-6647/pl.teminalmobile W/System.err: java.net.SocketTimeoutException: Read timed out
11-09 08:44:05.030 5458-6647/pl.teminalmobile W/System.err: at java.net.SocketInputStream.socketRead0(Native Method)
11-09 08:44:05.031 5458-6647/pl.teminalmobile W/System.err: at java.net.SocketInputStream.read(SocketInputStream.java:151)
11-09 08:44:05.031 5458-6647/pl.teminalmobile W/System.err: at java.net.SocketInputStream.read(SocketInputStream.java:120)
11-09 08:44:05.031 5458-6647/pl.teminalmobile W/System.err: at java.net.SocketInputStream.read(SocketInputStream.java:106)
11-09 08:44:05.032 5458-6647/pl.teminalmobile W/System.err: at pl.teminalmobile.Service.Service22.start1(Service22.java:256)
11-09 08:44:05.032 5458-6647/pl.teminalmobile W/System.err: at pl.teminalmobile.Service.Service22.access$000(Service22.java:75)
11-09 08:44:05.032 5458-6647/pl.teminalmobile W/System.err: at pl.teminalmobile.Service.Service22$19.run(Service22.java:963)
11-09 08:44:05.033 5458-6647/pl.teminalmobile W/System.err: at java.util.TimerThread.mainLoop(Timer.java:555)
11-09 08:44:05.033 5458-6647/pl.teminalmobile W/System.err: at java.util.TimerThread.run(Timer.java:505)
这一行引起了 SocketTimeOutException :
while ((bytesRead = inputStream.read(content)) != -1) {
【问题讨论】:
-
为什么不提行号?
-
Service22.java:256) 11-09 08:44:05.032 5458-6647/pl.teminalmobile W/System.err: at pl.teminalmobile.Service.Service22.access$000(Service22.java:75) 11-09 08:44:05.032 5458-6647/pl.teminalmobile W/System.err: at pl.teminalmobile.Service.Service22$19.run(Service22.java:963)。那些线上是什么?他们导致超时不是吗?