FTP NLST From WM5 to UNIX

I use th FTP example from Microsoft (kbms-help://MS.VSCC.v80/MS.MSDN.v80/MS.KB.v10.en/enu_kbvbnetkb/vbnetkb/832679.htm)and it connect but in the GetFileList function when reach to line:

bytes = cSocket.Receive(m_aBuffer, m_aBuffer.Length, 0)

it doesn’t return.

It works fine with PPC30 and with WM5 when I connected to my Windows XP with ActiveSync.

But when I connected via modem with UNIX it only works with PPC30 and I need the application for the news WM5 PDAs and for the PPC30 also.

Can somebody help me with this issue.



Answer this question

FTP NLST From WM5 to UNIX

  • susy_pmm

    cSocket.Receive its not return at the first time, it means 0 succeed times at this point.

    thanks.


  • stevejebson

    I am moving this over to the compact framework forum as this problem is specific to that platform.

  • hmayer

    I need download and upload files from PDA to UNIX server, and I have two PDA models:

    The oldest one is a DELL Axim with Pocket PC 2003, in this one I installed the NETCFv2.ppc.armv4.cab from "C:\Archivos de programa\Microsoft Visual Studio 8\SmartDevices\SDK\CompactFramework\2.0\v2.0\WindowsCE\wce400\armv4" and my program it works fine.

    The newest is a DELL Axim X51 with Windows Mobile 5.0, in this one I installed the NETCFv2.wce5.armv4i.cab from "C:\Archivos de programa\Microsoft Visual Studio 8\SmartDevices\SDK\CompactFramework\2.0\v2.0\WindowsCE\wce500\armv4i" and my program open the connection with the UNIX FTP server but I cant LIST the files there.

    The program works fine in the two PDAs when I try the connection with Windows XP via ActiveSync.


  • Jag711

    Couple of things:

    1) Can you get a network sniff (using Netmon or Ethereal) of the interaction between client and server

    2) can you clarify this statement

    bayito wrote:

    But when I connected via modem with UNIX it only works with PPC30 and I need the application for the news WM5 PDAs and for the PPC30 also.

    Do you mean it doesn't work when you try to connect to a Unix Ftp server

    3) Can you compile this ftp code with the regular .Net framework on a PC (instead of compact framework) and hit the same server What is the result If it works on a PC but fails on the compact framework, then we may need to follow up with the compact framework team...



  • ron2464

    Ok, well my 5 minute review of the code for that KB article gives me this code (inside the GetFileList method):

    Do While (True)
    m_aBuffer.Clear(m_aBuffer, 0, m_aBuffer.Length)
    bytes = cSocket.Receive(m_aBuffer, m_aBuffer.Length, 0)
    m_sMes += ASCII.GetString(m_aBuffer, 0, bytes)

    If (bytes < m_aBuffer.Length) Then
    Exit Do
    End If
    Loop

    The statement "If (bytes < m_aBuffer.Length) then..." seems wrong to me. It is possible for a Socket.Receive call to use less than the full buffer but not have the full message from the server (especially on a slow connection). I don't remember the FTP protocol specifics all that well, but this code needs to be changed so that it correctly determines the end of the data on that socket stream - it could be a closed socket (zero bytes read) or something else - don't remember for sure. I will shoot an e-mail off to the System.Net team and see if they know the answer...

    Also, what are the contents of the m_sMes variable at the time of the hang How many times did cSocket.Receive() succeed before it blocks



  • BogN

    I am not sure of the cause of the issue. The KB article has been removed and I was not able to access it. You may want to try the FtpWebRequest from OpenNETCF.org at http://www.opennetcf.org/library/ to see if their solution would work on your device.

    Cheers,

    Anthony Wong [MSFT]


  • Hamez

    I am not that familiar with the code in that sample, but I wonder if there is a reason why you don't use the System.Net.FtpWebRequest class to handle the FTP protocol for you.  I wouldn't recommend that you try to use a socket level implementation of the FTP protocol unless you have to.  Note that this class is new to the .Net Framework 2.0.

  • MrCRM

    This class is not supported by the .NET Compact Framework and I need run my app in the PDA.
  • FTP NLST From WM5 to UNIX