Android - Arduino server client app

Hello,

Take one Arduino UNO R3, a Arduino Wifi Shield, a Sparkfun Can-Bus Shield and one Android Tablet.

The server is o the tablet, arduino board acts as a client. I receive data from some height, pressure sensors through the Can-Bus shield and sent it to the Android tablet through the Wifi shield. Note that the tablet also can send commands through the Arduino board/shields.

My problem is that the communication from the board to the tablet is either very slow, it takes seconds to send a few messages, or it doesn't send at all, it simply crashes. It's true that the sensors send allot of information but I don't think it should act like this. Even if i completely remove the Can shield and send a simple string, it acts strange, sometimes it crashes, sometimes works but only for a few seconds, but still laggy.

If you may, any solutions? If you ask I can give any information about my project. Thanks in advance.

Given the information you have provided, could be poor code or the wifi connection, or maybe something else.

Here is the code, if you can take a look. Thanks.

Code