Delphi XE5 Android problem (Indy TCP) [Edit]

Hi!

Have some major problems, no ideas left.

My Android app. is using a component TCP Server-Client Library (http://www.3delite.hu/Object%20Pascal%20Developer%20Resources/TCPServerClientLibrary.html) that I made before. The server app. is built with Delphi XE2 and is using this same component too. The problem is that when I try to download some files with it to Android the Android app. either freezes, or the download stops, randomly (sometimes 3 files arrive successfully and then freezes/stops). Testing with 3 10MB and 2 100MB audio files which are 
transfered at the same time.

What I tried so far: Compiling the component to a XE2 Win32 app. works perfectly. Also tried compiling with XE5 as a Win32 app. also works perfectly (or at least seems so). Then tried creating a test Android app. which does nothing more then downloads these 5 files, and it does download the files but then starts acting weird. For example I click on a button and nothing happens.
The test files seem perfect in all cases. I can open them after the transfer in an audio editor and there are no problems. Also tried loading the files after they are transfered successfully to Android, they are all ok too.

For me it seems like a memory overwritten problem - as it results random errors.
My only idea is that the problem is that the Android nextgen compiler falsely frees some objects and I use them after. I tried to increment the reference count on all objects that are added to the lists (even incremented them 3 times just to be sure) but this didn't help. I have no idea what the problem is and no idea how to track it down.

This is my last hope asking on this forum. I spent more then a month developing this app. and in the and it gives such an error that I don't know how to solve.

Please help, any ideas suggestions are welcome!
I am willing to give free licenses or registrations to my programs for anyone who takes a look at the component's source code and can give a little help (http://www.3delite.hu/).

Thank you!
0
Utf
6/24/2014 9:12:23 PM
embarcadero.delphi.firemonkey 4901 articles. 4 followers. Follow

9 Replies
2770 Views

Similar Articles

[PageSpeed] 48

Had some time for this issue.

Made a test program pair, a Windows server and a client buildable for Windows and as well for Android.
Added hashing for the transfered files, which is checked by the client.

As far as I can tell, the Windows version (client) seems working perfectly all the time.
On Android sometimes the hash is incorrect. The other problem is that the client app. after the transfer, starts acting weird. For example I tap on 'disconnect' button, it changes it's color, then changes it's color back and nothing happens. Like the OnClick event is not called. I tap on it a couple of times and then disconnects.
The problem is that there are unpredictable bugs but no access violations or any concrete errors.

The bug tester apps sources are downloadable from here: http://www.3delite.hu/TCP%20Server-Client%20Library/Downloads/TCP%20Server-Client%20Library%20bug%20tester.zip
There's an instruction text file in the package on how to reproduce the bug.

Please if you have time, please take a look at it!
Don't understand why the Windows build seems working just fine, while the Android build is not. The problem can be with TCP Server-Client Library (most likely - some difference when built for Win32 or Android/Nextgen!?) or the Indy TCP client component for Android, but that's unlikely.

Thank you very much!
0
Utf
6/24/2014 9:14:52 PM
Ede wrote:

> Have some major problems, no ideas left.

What does this have to do with Indy?

> The problem is that when I try to download some files with it to
> Android the Android app. either freezes, or the download stops,
> randomly (sometimes 3 files arrive successfully and then freezes/stops).

Then you are likely not reading the transmitted file data correctly.  An 
do make sure you are NOT trying to download the files in the Android app's 
main thread, use a worker thread if you are not already.

> Then tried creating a test Android app. which does nothing more then
> downloads these 5 files, and it does download the files but then starts
> acting weird. For example I click on a button and nothing happens.

Sounds like you are doing something that is blocking the main thread.  Don't 
do that.

> For me it seems like a memory overwritten problem - as it results
> random errors.

No way anyone can diagnose that without seeing your actual code.

> My only idea is that the problem is that the Android nextgen compiler
> falsely frees some objects and I use them after.

Not likely, considering that all objects are reference counted.

> I have no idea what the problem is and no idea how to track it down.

Then please show the actual code that is n working for you.

--
Remy Lebeau (TeamB)
0
Remy
6/24/2014 9:26:09 PM
Ede wrote:

> On Android sometimes the hash is incorrect.

That goes back to my earlier reply that your Android code is likely not reading 
the transmitted data correctly.  And since your client/server apps are using 
a messaging library, the problem has to be inside the library itself.  Taking 
a cursory glance through the library, I see a lot of areas of code that are 
unsafe/inefficient in general, so I stopped looking.

--
Remy Lebeau (TeamB)
0
Remy
6/24/2014 9:56:53 PM
Ok. Just one question: how can the same code work perfectly for Win32 and not for Android?
0
Utf
6/25/2014 9:56:26 PM
Ede wrote;

> Ok. Just one question: how can the same code work perfectly for
> Win32 and not for Android?

I can't answer that since you have not isolated the actual culprit yet.

--
Remy Lebeau (TeamB)
0
Remy
6/25/2014 10:10:10 PM
Ok, thank you Remy Lebeau, please stop posting in this topic, I am not interested in your stupid answers.

If anyone has a reasonable suggestion please let me know.
0
Utf
6/25/2014 10:25:47 PM
Ede wrote:

> Ok, thank you Remy Lebeau, please stop posting in this topic,
> I am not interested in your stupid answers.

Wow, talk about a rude remark.  Considering that I am the primary developer 
of Indy, and I am the one who has taken any time at all to look at your code 
and try to help you, I would expect you to be nicer.  It is not my fault 
you are not debugging your own code or providing adequate information to 
diagnose your problem with.  So fine, I won't try to help you any further.

--
Remy Lebeau (TeamB)
0
Remy
6/25/2014 10:48:16 PM
Got it working. Turns out the problem was that I was checking the Indy TCP client component's Connected property from the main thread and the client component was used in a separate thread in the mean time.
Didn't get any crash/freeze since I commented out this check. And the downloads seem successful.

That's all for now, thank you for your time.

Edited by: Ede Csanádi on Jul 1, 2014 11:18 PM
0
Utf
7/1/2014 9:18:44 PM
Hello Ede,

> Got it working. Turns out the problem was that I was checking the Indy
> TCP client component's Connected property from the main thread and the
> client component was used in a separate thread in the mean time.

Yeah, don't do that.  Connected() could end up reading data that the worker 
thread is waiting for, and you could get the contets of the IOHandler.InputBuffer 
out of sync.

--
Remy Lebeau (TeamB)
0
Remy
7/1/2014 10:08:46 PM
Reply:

Similar Artilces:

Delphi XE5 TWebBrowser Problem on Android [Edit]
I have write 4 samples code: 1) paginaweb:='file://'+pathpdf+'prova.pdf'; webbrowser1.URL:=paginaweb; 2) paginaweb:='http://www.ufficiotecnicogecom.com/Volantini/prova.pdf'; webbrowser1.URL:=paginaweb; 3) have used webbrowser1.Navigate(paginaweb); 4) paginaweb := 'http://www.youtube.com/user/SisaCentroSudGecom'; webbrowser1.Navigate(paginaweb); or webbrowser1.URL:=paginaweb; webbroser1 is in a mobile form. All not work on Android but work fine on iOS, the case of youtube url load page but still stuck on loading vide...

SEPA components for Delphi with Source Code (Delphi 5
Hi all, in the european union change next year the Bankingformat to the SEPA Format. All peoples and companies must change the bankingssoftware and the costumer data form acountnummers in the new IBAN and BIC numbers. See: http://www.arma-it.de/shop/artikelueber.php?wgruppeid=211&wgruppe_offen=211 Functions: - generate SEPA XML'S - Calc IBAN - BIC Database (DE,AT and CH) Questions: vertrieb@arma-it.de PS: Bankinssoftware for Develpoers (Germany only) http://www.arma-it.de/shop/artikelueber.php?wgruppeid=212&wgruppe_offen=212 El 26/10/13 21:38, A...

Delphi XE5 Android App dies preparing INDY email [Edit]
Can someone help me with the following code, it connects and authenticates the idsmtp connection but the app dies on the line:- idMessage1.Recipients.EMailAddresses:='colin@gmail.com'; Anyone had and overcome this problem? procedure TForm3.Button1Click(Sender: TObject); begin if idSMtp1.Connected = true then idsmtp1.Disconnect; idsmtp1.Connect; //THIS LINE WORKS idSmtp1.Authenticate; //THIS LINE WORKS idMessage1.Clear; //THIS LINE WORKS ...

Does Delphi XE5 on Android work with the Android emulator? [Edit]
I find that even a hello-world app exactly like the one that David I outlines (add a button, one line of code, set button text) will not run on the Android Emulator configured out of the box. First, after installing the Rad Studio XE5 trial, I followed David I's steps exactly, and the emulator would not even start. Then I clicked Android SDK manager, updated it, and clicked run-without-debugging. It asked me if I wanted to start the emulator this time so I did. Now the Firemonkey app will not start up the emulator, and while it does appear to start debugging, the emulator scree...

Converting Delphi 2007 Indy 10.2.3 to Delphi 2009 Indy 10.5.5 [Edit]
Hello, I am currently attempting to port over a Delphi 2007 project that uses Indy 10.2.3 (very successfully) to Delphi 2009 and Indy 10.5.5 (I just got the latest development build this morning). I think I am running into an encoding issue, but am not sure. Specifically, IDHTTP with SSL calls an old CGI and the CGI returns a .zip file and I then save it to the disk. In 2007 and before this worked perfectly. In 2009, it is not. Here is the examples of the 2 different results (though cut way short in the post) I am getting back: 2007: 'PK'#3#4#$14#0#0#0#8#0'rLQ9žrPb€'#0...

Delphi 2006 to Delphi XE Crystal BPL problem [Edit]
I am in the process of migrating our application from Delphi 2006 to Delphi XE and, for ease of use, I have both 2006 and XE installed on my development computer. I access Crystal Reports XI RDC in our application and so I rebuilt the BPL in XE in order to add the new package to XE. However, when I try to add the package to XE I get the error message: “Registration procedure, Craxddrt_tbl.Register in the package c:\Documents and Settings\All Uers\Documents\RADS Studio\8.0\BPL\Crystal.bpl raised exception class EFilerError: Component TDatabase can’t be registered by package crystal.bpl be...

movetasktoback function delphi xe5 android? [Edit]
Hi, I want my application not close when the back button is pressed. I want it to minimize and run in background. Is this possible? I've saw a movetasktoBack function on Java. Is this function available for Delphi too? {code} public class TestActivity extends Activity { //... // Working for all API levels @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { moveTaskToBack(true); } return super.onKeyDown(keyCode, event); } // Alternative variant for API 5 and higher @Override ...

android service application on Delphi XE5 [Edit]
Is it possible to develop "android service application(backround)" on delphi xe5 ? if possible, how to ? Thanks. Edited by: caner aytac on Sep 20, 2013 3:40 AM Edited by: caner aytac on Sep 20, 2013 3:45 AM ...

Delphi XE5 Android Heap size problem
Android applications that developed with Delphi XE5 use minimum 24 MB RAM. Some phones allow 16-20 MB usage(heap size) for any application. (htc wildfire S A510e, samsung GT-S58330i) So any application that developed with Delphi XE5 does not run these phones. But I have seen some popular applications these can use greater than 30 MB heap size on these phones. if some android applications were able to do this, Is there any way to automatically increase the heap size for our delphi xe5 applications? > {quote:title=mustafa korkmaz wrote:}{quote} > (htc wildfire S A510e, Wi...

Delphi XE5 DataSnapRest server problem [Edit]
Hi all I use Delphi XE5, Update2. I made a small DataSnapRest Application. 1. If I select on step 3 "ServerModule" that is support for heavy callback, the web page does not working at all. (the default application that is created is not working when I press "Open Browser" button). 2. If I create a non "ServerModule" and the IDE put the TDSServer and TDSServerClass on the WebModule with the rest of the default components (like TDSHTTPWebDispatcher, TPageProducer, TDSProxyGenerator, TDSServerMetaDataProvider) is working well for a period of time. I cr...

Indy TIdUdpServer OnRead problem on Delphi XE [Edit]
Hi, I have some problem with Indy TIdUDPServer on Delphi XE becouse when I try to double click on the +OnUDPRead+ events in the object inspector Delphi return this error: *"Expected '>' but '.' found.* This is the generated source code: {code} type TForm2 = class(TForm) IdUDPServer1: TIdUDPServer; procedure IdUDPServer1UDPRead(AThread: TIdUDPListenerThread; AData: TArray<System.Byte>; ABinding: TIdSocketHandle); private public end; var Form2: TForm2; implementation {$R *.dfm} procedure TForm2.IdUDPServer1UD...

Does Delphi XE5 firemonkey work on current Samsung tablets? [Edit]
I am being told that Delphi XE5 with firemonkey will not work on the current range of Samsung tablets even if they have Android 4 is that true? If so I will be very disappointed having invested thousands of pounds and a few hundred hours to adopt the technology on the promise I can now deploy to Android mobile devices. When I run even the most simple Hello World app I simply get a black screen on my brand new Samsung tablet. I am told it only works on Android devices with a ARMv7 CPU supporting NEON instruction sets. If this is the case developers need to know that I have been told today ...

Delphi XE5 instant trial: Android emulator does not run [Edit]
Installed XE5 instant trial - no problem. The "Android Tools" menu is missing, although It is supposed to be installed by default according to the installation notes. Note: the Instant Trial does not offer any installation options. So I started the SDK manager from the File Browser in the IDE, all the files are there. Installed an Android system image - no problem. Created an emulator - no problem. Tried to start the emulator: PANIC - can not start +devicename+ . Tried all standard devices - same problem. A problem with the "virtualized" paths inside Ap...

Delphi XE2 - Indy 10
Dear folks As result of security issues one of the email services in NZ has changed the settings of their email server. It used to be port 25 and outgoing mail was SMTP.xtra.co.nz. The port is now 465 and outgoing mail is now send.xtra.co.nz. The client configuration requires authentication and a secure connection (SSL). The result is that my code to connect for everyone using that provider is now "busted". I have changed the port and outgoing host accordingly. And have set the IOHandler of idSMTP as IdSSLIOHandlerSocketOpenSSL1. With the Authtype as satSASL. I have als...

Web resources about - Delphi XE5 Android problem (Indy TCP) [Edit] - embarcadero.delphi.firemonkey

Android Apps - Appolicious ™ App Directory
... You'll Love in association with Trending: games photography photo editing keyboards Join Sign In with Yahoo! Already a member? Log in Android ...

Android phone name generator
Just click on the logo. ∞ Read this on The Loop

Android version history - Wikipedia, the free encyclopedia
Global Android version distribution since December 2009. As of January 2014, Android 4.x Jelly Bean is the most widely used Android version, ...

The only small-screened Android phone worth buying is coming to the US
Sony The Xperia Z5. 10 more images in gallery If you long for the days of 2011, when 5.3-inch smartphones were enormous outliers rather than ...

The 2017 Hyundai Elantra gets both Apple CarPlay and Android Auto
... buys for those on a budget. Today, Hyundai announces that the 2017 model of the aforementioned car will be getting both Apple CarPlay and Android ...

New study shines light on one of the iPhone’s biggest advantages over Android
We hate to kick a dead horse but unfortunately, Android fragmentation is an issue that continues to rear its ugly head. Time and time again we ...

You'd say 'no' to your Android phone, if only you could, study finds
Users would deny almost a third of all requests for permission made by Android apps, according to a report. Ideas for a fix include a security-minded ...

Android Auto is coming to 40 car models this year
Google is positive about the road ahead for Android Auto, saying it will come to 40 car models and support more apps this year. Android Auto ...

Android Pay’s awesome rewards program offers free content and Chromecasts
... the way with a new rewards program — and it’s awesome. Dubbed “Tap 10,” the program offers up free Google Play content simply for using Android ...

I Have No Mouth, and I Must Scream is now on iOS, Android
... (the group reviving System Shock ) and DotEmu have come out with a mobile port of I Have No Mouth, and I Must Scream . It's out now on Android ...

Resources last updated: 1/16/2016 8:15:19 AM