简体   繁体   中英

Im getting ERROR: null W/System.err(20560): java.io.EOFException from a network.request in Corona

    local body = "userId=31"
    local params = {}
    params.body = body

network.request( server/someifle.php", "POST", networkListenerRequests, params))

everything work fine, but at some random moments, I get an error in the networkListenerRequests.

If you read this post on stack overflow, Spring Rest Template usage causes EOFException they mention something about an attribute keep alive. Can this be set in corona or does anyone know anything else I can do?

The error message: E/Corona (20560): ERROR: null W/System.err(20560): java.io.EOFException W/System.err(20560): at libcore.io.Streams.readAsciiLine(Streams.java:203) W/System.err(20560): at libcore.net.http.HttpEngine.readResponseHeaders(HttpEngine.java:579) W/System.err(20560): at libcore.net.http.HttpEngine.readResponse(HttpEngine.java:827) W/System.err(20560): at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:283) W/System.err(20560): at libcore.net.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:497) W/System.err(20560): at network.NetworkRequest$AsyncNetworkRequestRunnable.run(NetworkRequest.java:1394) W/System.err(20560): at java.lang.Thread.run(Thread.java:841)

you can change any header of HTTP request with params.headers In your case it will look like this

local body = "userId=31"
local params = {}
params.body = body
params.headers = {};

params.headers["Connection"] = "close";

network.request("server/someifle.php", "POST", networkListenerRequests, params))

Hope this helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM