Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Questions (Windows Mobile)
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Questions (Windows Mobile) Post any question regarding Basic4ppc.

FTP file download fails on device

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-30-2008, 10:57 PM
willisgt's Avatar
Senior Member
 
Join Date: Aug 2007
Location: Nacogdoches, Texas USA
Posts: 162
Default FTP file download fails on device

I've written a routine which dowloads files via the FTP library. In order to preserve the ability to update a progress bar during the download, I use the threading library to create a thread which actually downloads the file.

All of this works just fine if compiled for the desktop (optimization is on). However, it fails on the device. I'm getting an error message that an optional resource assembly was not found.

The code for the thread itself is just this simple:
Code:
Sub threadSyncFile_ThreadCode

    ErrorLabel( threadSyncFile_ThreadCodeError )
    
    ftpSyncFile.GetFile( labelSyncFileSource.Text, labelSyncFileTarget.Text )

    syncSetLastDownload( labelSyncFileSource.Text )
    
threadSyncFile_ThreadCodeError:

    labelSyncFileTarget.Text    = 
""
    labelSyncFileTarget.Refresh

    
Return

End Sub
I've double-checked, and yes, I've got FTPDevice.DLL installed on the device.

The desktop is running Windows XP Pro; the Basic4PPC version is 6.05; the device is an HTC 8925/AT&T Tilt running Windows Mobile 6.

I've beaten my head against a wall too many times already this week; anyone have any ideas, especially why this works on the desktop, but not the device?

Gary

Reply With Quote
  #2 (permalink)  
Old 01-30-2008, 11:12 PM
willisgt's Avatar
Senior Member
 
Join Date: Aug 2007
Location: Nacogdoches, Texas USA
Posts: 162
Default

A little more insight into the problem...

I commented out these two lines and still got the same error:
Code:
'    ftpSyncFile.GetFile( labelSyncFileSource.Text, labelSyncFileTarget.Text )

'    syncSetLastDownload( labelSyncFileSource.Text )
And was able to catch a more robust error message:

Not Supported Exception
An error message cannot be displayed because an optional resource assembly containing it cannot be found

at Microsoft.AGL.Common.MISC.HandleARr()
at System.Windows.Forms.Form.Close
at Dbasic.b4p.ShowError()
at Dbasic.b4p._threadsyncfile_threadcode()
at Dbasic.b4p._threadsyncfile_threadcode()
at Threading.Thread.wrapper()

???

Last edited by willisgt : 01-30-2008 at 11:21 PM.
Reply With Quote
  #3 (permalink)  
Old 01-31-2008, 02:52 AM
willisgt's Avatar
Senior Member
 
Join Date: Aug 2007
Location: Nacogdoches, Texas USA
Posts: 162
Default Answered my own question

Answer: threads are not GUI-safe.

Don't try to update anything GUI-related (like the text of a label) from within a thread's code.

Reply With Quote
  #4 (permalink)  
Old 01-31-2008, 11:45 AM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 6,072
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

Quote:
Originally Posted by willisgt View Post
Don't try to update anything GUI-related (like the text of a label) from within a thread's code.
It's all documented there in the help and in the comments of the example application. That's why thread events are provided. The example porgram shows a thread updating a textbox using a thread event.

Edit :-The missing resource assembly contains the actual error messages that would give a bit more detail about the error. So the original error cannot be displayed triggering a further missing resource error! See this thread http://www.basic4ppc.com/forum/questions-windows-mobile/870-error-messages-device.html

Last edited by agraham : 01-31-2008 at 11:51 AM.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Linking ProgressBar to file download? N1c0_ds Questions (Windows Mobile) 3 11-03-2008 03:57 AM
help with download file Byak@ Questions (Windows Mobile) 2 07-14-2008 06:14 PM
Can I upload and download files from device to PC superbabicka Questions (Windows Mobile) 2 03-31-2008 02:47 PM
Word wrap fails on label control (device only) willisgt Questions (Windows Mobile) 4 11-18-2007 12:46 AM
.sbp file association in the Device Cableguy Code Samples & Tips 8 05-18-2007 02:12 PM


All times are GMT. The time now is 06:47 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0