Tag: eofexception

java.io.EOFException使用kso​​ap2 lib libcore.io.Streams.readAsciiLine(Streams.java:203)

03-26 14:12:19.045: E/Webservices(2863): java.io.EOFException 03-26 14:12:19.045: E/Webservices(2863): at libcore.io.Streams.readAsciiLine(Streams.java:203) 03-26 14:12:19.045: E/Webservices(2863): at libcore.net.http.HttpEngine.readResponseHeaders(HttpEngine.java:560) 03-26 14:12:19.045: E/Webservices(2863): at libcore.net.http.HttpEngine.readResponse(HttpEngine.java:813) 03-26 14:12:19.045: E/Webservices(2863): at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:274) 03-26 14:12:19.045: E/Webservices(2863): at libcore.net.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:486) 03-26 14:12:19.045: E/Webservices(2863): at org.ksoap2.transport.ServiceConnectionSE.getResponseCode(ServiceConnectionSE.java:103) 03-26 14:12:19.045: E/Webservices(2863): at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:197) 03-26 14:12:19.045: E/Webservices(2863): at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:118) 03-26 14:12:19.045: E/Webservices(2863): at .utils.Webservices.callinternet(Webservices.java:125) 03-26 14:12:19.045: E/Webservices(2863): at .utils.Webservices.getResponse(Webservices.java:73) 03-26 […]

DataInputStream给出了java.io.EOFException

我创建了小型CLI客户端 – 服务器应用程序。 加载服务器后,客户端可以连接到服务器并将命令发送到服务器。 第一个命令是获取服务器加载的文件列表。 一旦建立套接字连接。 我请求用户输入命令。 ClientApp.java Socket client = new Socket(serverName, serverPort); Console c = System.console(); if (c == null) { System.err.println(“No console!”); System.exit(1); } String command = c.readLine(“Enter a command: “); OutputStream outToServer = client.getOutputStream(); DataOutputStream out = new DataOutputStream(outToServer); out.writeUTF(command); 然后服务器捕获用户的命令并发送相应的回复。 SeverApp.java – Socket server = serverSocket.accept(); DataInputStream in = new […]

访问远程服务器时MySQL连接出错

我在网络服务器上 托管了一个MySQL数据库 。 我已授予所有权限并允许我的IP从本地计算机远程连接到此数据库 。 它连接起来,我能够从数据库中检索数据到我的Java Swing应用程序。 但是,有时我收到此错误消息,并且我与托管数据库的连接失败。 错误如下所示: Apr 7, 2012 12:49:20 AM scm.new_fas txtSearchKeyReleased SEVERE: null com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception: ** BEGIN NESTED EXCEPTION ** java.io.EOFException MESSAGE: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost. STACKTRACE: java.io.EOFException: Can […]

何时会在JAVA的流中发生EOFException

我正在使用DataInputStream并有一个关于EOFExceptions的问题。 根据java文档: 表示在输入期间意外到达文件末尾或流末尾的信号。 此exception主要由数据输入流用于信号流的结束。 请注意,许多其他输入操作在流的末尾返回特殊值而不是抛出exception。 这是否意味着当生成EOFException时,流不会再次打开? 这是否意味着你永远不会期待它的更多数据? 如果输出流连接到输入流并且调用了outputstream.close(),输入流是否会收到EOFException或IOException? IOException被描述为: 表示发生了某种I / Oexception的信号。 此类是由失败或中断的I / O操作产生的一般exception类。 输出流上的close是否会在datainputstream端产生EOFException或IOException?