Apperently in OS 3.1 CmdFTP was written using the datastructures found in
the header file DataPrv.h
In OS 3.5 that header is not included.
When I upgraded my Codewarrior to 7 from 6 I had to go get the PalmOS 3.1
SDK because the header wasn't included.
When I was then told by Tech Support at Metrowerks that the structures were
going to change and that we need to rely on the API instead but should work
in PalmOS 3.5. So I took a look at the NetSample provided in the 3.5 toolkit
to see how it was done and it wouldn't even compile. THere were a bunch of
errors. So since I have a client waiting I thought I'd do all the necessary
CW 6 to CW 7 conversions and worry about that for PalmOS 4. Since I couldn't
get it to work in my app I then again thought I'd go back to the original
sample. I got it to work except now the sample app hangs on a
NetLibSocketAccept. I then changed the NetSocket.lib to be the one from 3.1
instead of 3.5 just in case - same thing. My app is now doing the same.

3 things...

1) Will PalmOS be providing a CMDFtp.c (using the API)that at least compiles
and hopefully works?
2) If the database structures are going to change, what about those of us
out there that generate .pdb files on a PC to be sent to the Palm? Will the
structures be published or something provided so we still can generate the
files?
3) Here is a snippet on where I am hanging in the NetLib from the sample  -
can someone help with this?
The funny thing is that the FTPPut works fine through the socket and the
FTPGet works fine as long as there is a file there. But if it is missing it
does not timeout and give an error appropriately. That is when it hangs.


***** The command that is processing when it hangs is...
***** RETR myFilename.dat
***** Remember if it is there it is fine - if not - it hangs. It should
error out.

static void FTPGet(UInt16 argc, CharPtr argv[])
        Int16           acceptSock = -1;
        Int16           dataSock = -1;

        UInt16  reply;
        struct  sockaddr_in address;
        Int16           addrLen;

        gFTPGetErr = 0;

        // Syntax check
        if (argc < 2) {
                printf("\nSyntax: %s <filename>", argv[0]);
                return;
                }

        // Send the type command to put us into binary mode
        StrPrintF(FTPCommand, "TYPE I\r\n");
        NetUWriteN(FTPCtlSock, (UInt8 *)FTPCommand, StrLen(FTPCommand));
        if (FTPGetReply(FTPCtlSock, &reply)) goto Exit;
        if (reply >= 400) goto Exit;


        // Create a data port to get the results
        acceptSock = FTPDataAcceptSocket();
        if (acceptSock < 0) return;
        printf("\nSocket opened");


        // Send the RETR command
        StrPrintF(FTPCommand, "RETR %s\r\n", argv[1]);
        printf("\nDEBUG: Send GET command is: %s", FTPCommand);
        printf("\nDEBUG: FTPCommand is %d bytes long", StrLen(FTPCommand));
        NetUWriteN(FTPCtlSock, (UInt8 *)FTPCommand, StrLen(FTPCommand));


        printf("\nDEBUG: FTPGetReply");
        // Get Reply from the RETR command
        if (FTPGetReply(FTPCtlSock, &reply)) goto Exit;
        printf("\nDEBUG: FTPGetReply check return code is %d", reply);
        if (reply >= 400) goto Exit;
        printf("\nDEBUG: After FTPGetReply");


        // Accept a connection on our data port
        addrLen = sizeof(address);
        printf("\nDEBUG: addrLen is: %d", addrLen);

/***
****  This is where I am hanging. If I comment out this line and then
obviously
****  the FTPDatabaseRead lines for they are dependant I no longer hang.
****/
      if ((dataSock = accept (acceptSock, &address, &addrLen)) < 0) goto
Exit;
/***/
        // Read the file
        printf("\nRead the database");
        errno = FTPDatabaseRead(0, argv[2], dataSock);


        // Get Transer complete message
        FTPGetReply(FTPCtlSock, &reply);

Exit:
        if (errno)
        {
                gFTPGetErr = 1;
                gFTPErr = 1;
                printf("\nError: %s", appErrString(errno));
        }
        if (acceptSock >= 0) close(acceptSock);
        if (dataSock >= 0) close(dataSock);
        printf("\nSocket and data port closed");
        //printf("\nDatabase %s recieved", argv[1]);
}


Thanks,
Daniel A. Schultz
Symmetry Software, Inc.
517.414.3920
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to