Processing.net: High timeout, when the client socket tries to connect and the server does not exist

Hello

I am making an android app.

the processing.net library works great while the server is working.

However, when I try to turn on the Android app (client) and the server is idle, the app crashes for over a minute. Using processing.net in windows, something similar happens, but the waiting time is reduced to about 15-20 seconds.

The main problem is that while java creates the connection, the app is frozen. and a high wait time is an important issue if the server goes down.

How can solved this, is there any way to jump code, if no socket is created in x seconds?

A greeting and thanks in advance,

Emperador_Tico

Comments

  • edited January 2015

    Well, finally I managed to fix the error by changing the processing.net library.

    I suggest developers, include a time limit, I put three seconds. What can not be is that the app android timeout to skip the exception, in my case it is 2-3 minutes.

    new code: socket = new Socket(); socket.connect(new InetSocketAddress(this.host, this.port), 3000);

    change code: socket = new Socket(this.host, this.port);

    If anyone has the same problem I suggest copying the library to sketch and modify this fragment: https://github.com/processing/processing/blob/master/java/libraries/net/src/processing/net/Client.java

    Need not include import processing.net *; And everything will still work just as well.

    a greeting and I hope this will be helpful;)

Sign In or Register to comment.