OpenNETCF
(1)
Outlook
(1)
Directory.GetFiles
(1)
FtpClient.Dispose
(1)
UploadFileNameToMove
(1)
Thread.Sleep
(1)
FilesForUpload.Length
(1)
UploadFileToServer
(1)
FTP allows 47 files transfer but after that fails completely
Asked By @maram
12-Nov-09 10:18 AM

Hi all,
I have an FTP client developed in .NET 2.0 (SP1) C# app. Files are
transferred correctly for the first 47 times. After that, it just
fails and that is it. I am using the passive mode. The range of ports
for PASV mode on the FTP server is 1050 to 3500. And all ports are
open on the server machine. Firewall is also alrite. I am saying all
this because when the FTP transfer starts to fail, I shutdown and
restart the emulator (windows mobile 6.0) and the transfer again
succeeds before failing at around 50 times.
After debugging, I found that I can login at the FTP server and issue
the PASV command and get the port at which I need to connect to the
FTP server to transfer files. But when I am trying to open the data
connection, it fails saying the "server has actively refused
connection". We can think that the emulator cannot connect to the FTP
server on that port, but then why does the transfer work OK when the
emulator is restarted?
I have searched a lot on this topic but without vain.
FYI: I am transferring the files NON-STOP (one after the other) in a
Thread in my .NET app.
Thanking you all for your time,
Best regards,
-A
Which FTP implementation are you using?
Trevor replied to @maram
16-Nov-09 05:16 PM
Which FTP implementation are you using? Can you post some code in the loop
used to send the files? It sounds like there is a memory/resource leak in
the FTP implementation or in your code.
Hi Trevor,Thanks for your response.You've got a point.
@maram replied to Trevor
17-Nov-09 11:16 AM
Hi Trevor,
Thanks for your response.
You've got a point. However, the FTP client (on the help) uses two
sockets: one to send FTP commands and the second one is for data
connection (sending or receiving files). How do we explain the fact
that I am able to login at the FTP server and send the PASV command, I
get the result and back and I calculate the port on which to connect
to the FRP server. When I perform the connect on the data connection
socket, then it does not work.
I am using Google group on the web. How do I upload my codes?
Thanks in advance,
Best regards,
-A
loop
in
You can just copy/paste the code or use a Usenet client
Trevor replied to @maram
17-Nov-09 03:01 PM
You can just copy/paste the code or use a Usenet client (Outlook
Express/Windows Live Mail) and connect to
microsoft.public.pocketpc.developer using the Microsoft mail server and
attach the file. Are you writing your own FTP client from scratch? There
are some .NET FTP clients from OpenNETCF and the native WinInet FTP API can
be called from C# using PInvoke (see FtpOpen, FtpPutFile, etc. on MSDN). I
believe the OpenNETCF implementation is just a wrapper around WinInet to
make it work the same as the desktop .NET API.
This is a multi-part message in MIME format.------=_NextPart_000_0019_01CA6877.
A replied to Trevor
18-Nov-09 12:46 PM

This is a multi-part message in MIME format.
------=_NextPart_000_0019_01CA6877.0BBF8C20
Content-Type: text/plain;
format=flowed;
charset="iso-8859-1";
reply-type=response
Content-Transfer-Encoding: 7bit
Hi Trevor,
Attached is the code that I am using for FTP communication. I have not
written it myself, I found it on the net. But I have tested and it works
alright until I got the previously-mentioned problem.
My code that calls the FtpClient for file uploading is:
/********************************************/
//This is my UploadThread
private void UploadFiles()
{
String uploadFileNameToMove = null;
String[] filesForUpload = null;
while (isUploadOn)
{
filesForUpload = Directory.GetFiles (UPLOAD_DIR);
if (filesForUpload == null || filesForUpload.Length == 0)
{
Thread.Sleep(5 * 1000);
continue;
}
for (int i = 0; i < filesForUpload.Length; i++)
{
uploadFileNameToMove = filesForUpload[i];
uploadToServer(uploadFileNameToMove, true); //upload to
FTP server
if (hasErrorOccurred) // error occurred while
transferring file
{
Thread.Sleep(5 * 1000);
continue;
}
else
{
Utils.move(uploadFileNameToMove); //Move the
uploaded file to a different directory
uploadFileNameToMove = null;
}
}
}
}
private void uploadToServer(string uploadFileName)
{
FtpClient ftp = null;
try
{
ftp = new FtpClient("xxx.xxx.xxx.xxx","FtpUserName",
ftp.Login();
ftp.Upload(@uploadFileName);
}
catch (IOException)
{
hasErrorOccurred = true;
}
catch (Exception)
{
hasErrorOccurred = true;
}
finally
{
if (ftp != null)
{
ftp.Close();
}
}
}
/********************************************/
Can the gurus (including yourself, Trevor) please take a look/review the
codes and see if am doing something wrong?
Thanks and Regards,
-A
Does FtpClient have a FtpClient.Dispose method?
Trevor replied to A
19-Nov-09 11:45 AM
Does FtpClient have a FtpClient.Dispose method? If so, that should be
called to free the resources used by the FtpClient. I would recommend
creating a single FtpClient object outside of your loop and passing it into
your uploadFileToServer function so it can be re-used. Try something like
this:
/********************************************/
This is my UploadThread
private void UploadFiles()
{
String uploadFileNameToMove = null;
String[] filesForUpload = null;
while (isUploadOn)
{
filesForUpload = Directory.GetFiles (UPLOAD_DIR);
if (filesForUpload == null || filesForUpload.Length == 0)


just copy / paste the code or use a Usenet client (Outlook Express / Windows Live Mail) and connect to microsoft.public.pocketpc client from scratch? There are some .NET FTP clients from OpenNETCF and the native WinInet FTP API can be called from PInvoke (see FtpOpen, FtpPutFile, etc. on MSDN). I believe the OpenNETCF implementation is just a wrapper around WinInet to make it UploadFiles() { String uploadFileNameToMove = null; String[] filesForUpload = null; while (isUploadOn) { filesForUpload = Directory.GetFiles (UPLOAD_DIR); if (filesForUpload = = null | | filesForUpload.Length = = 0) { Thread.Sleep(5 Utils.move(uploadFileNameToMove); / / Move the uploaded file to a different directory uploadFileNameToMove = null; } } } } private void uploadToServer(string uploadFileName) { FtpClient ftp = null UploadFiles() { String uploadFileNameToMove = null; String[] filesForUpload = null; while (isUploadOn) { filesForUpload = Directory.GetFiles (UPLOAD_DIR); if (filesForUpload = = null | | filesForUpload.Length = = 0) keywords: FTP, allows
Mobile Apps OpenNETCF 1.4 assemblies Hi all! Please help to find assemblies for OpenNETCF 1.4 - OpenNETCF.Windows.Forms - OpenNETCF.Drawing - OpenNETCF I can not install the Smart Device Framework 1.4 advance You can still find the source here: http: / / www.opennetcf.org / download.asp?product = SmartDeviceFramework14 Marc Their were problems with the OpenNETCF 1.4 installer. Either download the source as sugested by are only compatible with Studio 2003. - - Chris Tacke - Embedded MVP OpenNETCF Consulting Managed Code in the Embedded World www.opennetcf.com - - keywords: OpenNETCF, 1.4, assemblies description: Hi all! Please help to find
Mobile Apps Error: Syncronization cannot be completed because Microsoft Outlook cannot open the Task folder Outlook 2007, WMDC 6.1, Axim x50v running WM2003 SE Error Synchronization cannot be completed because Microsoft Outlook cannot open the Task folder. Close Outlook. Restart Outlook. With Outlook running, disconnect mobile device and reconnet. If the problem persists, reinstall Outlook." I tried this and it doesn't work. Notes and so I know the connection is working. It's the Outlook 2007 Contacts, Calendar, and Tasks that don't work. Weirdly, Outlook Notes *do* sync. Everything was working fine until I decided files. What I've tried. Running a repair install on Outlook. Ran Office Diagnostics, which found nothing wrong. And of course
used folowing strings to do it inside Project.dat: Root:-Directory(" \ Windows") Directory(" \ Windows \ Desktop"):-Directory("Prova") Directory(" \ Windows \ Desktop"):-File("calib.lnk", " \ Windows \ calib.lnk") But after building image, I can find the directory Prova on DEsktop but NOT the link calib.lnk. The link on the desktop add the following to platform.dat Directory(" \ Windows \ LOC_DESKTOP_DIR"):-File("Calibraton Utility.lnk", " \ Windows \ calib.lnk") If the start programs menu add the followig to platform.dat Directory(" \ Windows \ LOC_PROGRAMS_DIR"):-File("Calibraton Utility.lnk", " \ Windows \ calib.lnk") Make can see in my message, I included the lines Root:-Directory(" \ Windows") Directory(" \ Windows \ Desktop"):-Directory("Prova") Directory(" \ Windows \ Desktop"):-File("calib.lnk", " \ Windows \ calib.lnk
pocket PC I found that it can only sync with Outlook. As I am not planning to buy MS Office, does won't help, since the device will only sync with Outlook on an XP machine as well (it will NOT sync with Outlook Express, which comes with XP.) You do not have to buy Office to get Outlook- Outlook is sold separately. Otherwise, if you wish to sync just internet, and use it's free web-based version of Outlook (Outlook Web Accress) on your Vista (or XP) PC. But on Activesync instead of Mobile Device Center which can work with Outlook Express, Right? No, ActiveSync works with Outlook, not Outlook Express. Under XP, there are thrird party programs that do
Mobile Apps WMDC - Outlook has not been installed - it is! I have a problem setting up what Outlook items to sync in WMDC. All the Outlook items are greyed out and underneath each item it says Outlook has not been installed." Outlook 2007 is indeed installed. I uninstalled both Outlook and GroupWise, apparently there must be some sort of mapi m not sure how to resolve. I then reinstalled both Outlook and GroupWise, checking WMDC after each reinstall. Even with no trace of GroupWise on the computer, WMDC still said that Outlook was not installed and therefore could not select which items to sync. BTW, both Outlook and GroupWise work fine together on the same machine as I've setup a second profile for Outlook. I made sure to clear out any GroupWise entries in
Mobile Apps syncing mobile outlook and outlook 2007 Using a pocket pc phone, I often want to check my mail and send replies. However, pocket outlook can't send or receive mail, just sync with desktop outlook. Is there a way to send and receive mail on Microsoft MVP Mobile Devices http: / / modernnomads.info I cannot send outlook mail on my pocket pc. I can send via another on the pocket pc but that does not sync with outlook That's normal (unless you're using Exchange)- Outlook mail is meant to be synched with Outlook and then sent from the desktop. Correct- POP has never and whistles." -Bill Maher 9 / 25 / 2003 keywords: syncing, mobile, outlook, and, outlook, 2007 description: Using a pocket pc phone, I often want
Mobile Apps Activesync or Outlook 2002 problem? Using Activesync 4.5 and Outlook 2002. When HTC Touch phone is disconnected and Outlook is closed, Outlook actually is still running as can be seen in Process which is configured to check the same email account) because Outlook is still pulling them down to the desktop PC thus removing them from the server. Killing Outlook in Process Explorer fixes the problem, of course, but that and maybe there is a setting to make it terminate Outlook's backgound process. Or, if it is an Outlook issue, then is it fixed in a later release? Hi In certain cases Outlook continues to run after you have completed synchronization. For example of downloading e-mail from your server when you "close" Outlook, it will continue to run in the background until the