I have an Android app that communicates with a server via asynchronous socket connection to transfer somewhat large packets of information (up to 11 Megs). In order to accommodate for this interactions I have placed small sleeps in key points of the data sending and receiving. On WiFi the connection works. Do to the size of the information one read or write doesn't seem to be sufficient but I have created functions to keep reading off the socket until the transfer is finished.
As I said all of this works on WiFi. However, on 3G or edge networks the transfer fails, interrupts midway, and generally is buggered. I have placed numerous checks and sleeps to ensure that information is given the opportunity to pass, however it fails to.
Unfortunately it is difficult to be clearer as to the source of the problem. I have worked for several days trying to clear up this problem as elegantly as possible with no avail.
TLDNR WiFi is able to send data but mobile networks fail. I need to know why and how to fix it.
Thank you.