How to use VxWorks ftpLib - VxWorks

This is a discussion on How to use VxWorks ftpLib - VxWorks ; Hi, Buddies I want to use ftp via ftpLib with account and password in vxWorks. How can I implement this? Thanks!...

+ Reply to Thread
Results 1 to 15 of 15

Thread: How to use VxWorks ftpLib

  1. How to use VxWorks ftpLib

    Hi, Buddies
    I want to use ftp via ftpLib with account and password in vxWorks. How
    can I implement this?
    Thanks!


  2. Re: How to use VxWorks ftpLib

    jeanwelly wrote:

    >Hi, Buddies


    Hey!

    >I want to use ftp via ftpLib with account and password in vxWorks. How
    >can I implement this?


    Begin by reading Chapter 8, Remote Access Applications, of the VxWorks
    Network Programmer's Guide and the ftpLib and ftpLib API emtries in the
    VxWorks OS Libraries Api Reference.

    IOW, RTFM!

    >Thanks!


    HTH

    --
    ================================================== ======================
    Michael Kesti | "And like, one and one don't make
    | two, one and one make one."
    mrkesti at comcast dot net | - The Who, Bargain

  3. Re: How to use VxWorks ftpLib

    Thanks Michael...

    The issue I encountered is:
    I want to use ftp to transfer some files from target board to a ftp
    server.
    o If I use the current board as the ftp server, the files can be
    transfered correctly.
    o But if an external ftp server, such as server in my pc, was used, it
    can't work.

    Personally, I guess the issue may not lies in the FTP itself, because
    its a widely used protocol. How to debug the root cause in VxWorks?
    Any firewall in my pc may cause this issue. I can't disable the
    firewall, because I am in the office.

    Any suggestions are welcome. Thanks!


  4. Re: How to use VxWorks ftpLib

    Thanks Michael...

    The issue I encountered is:
    I want to use ftp to transfer some files from target board to a ftp
    server.
    o If I use the current board as the ftp server, the files can be
    transfered correctly.
    o But if an external ftp server, such as server in my pc, was used, it
    can't work.

    Personally, I guess the issue may not lies in the FTP itself, because
    its a widely used protocol. How to debug the root cause in VxWorks?
    Any firewall in my pc may cause this issue. I can't disable the
    firewall, because I am in the office.

    Any suggestions are welcome. Thanks!


  5. Re: How to use VxWorks ftpLib

    test


  6. Re: How to use VxWorks ftpLib

    jeanwelly wrote:

    >Thanks Michael...
    >
    >The issue I encountered is:
    >I want to use ftp to transfer some files from target board to a ftp
    >server.
    > o If I use the current board as the ftp server, the files can be
    >transfered correctly.
    > o But if an external ftp server, such as server in my pc, was used, it
    >can't work.
    >
    >Personally, I guess the issue may not lies in the FTP itself, because
    >its a widely used protocol. How to debug the root cause in VxWorks?
    >Any firewall in my pc may cause this issue. I can't disable the
    >firewall, because I am in the office.



    Oh! Well, why didn't you say so in the first place?


    >Any suggestions are welcome. Thanks!


    I had a similar problem with my most recent client's project. One of
    the client's people soved it on their server's end, though, and I cannot
    recall what was the issue. Something to do with the size of a request,
    I think, but I'm really not sure. Perhaps this will be enough of a clue
    to help you, I hope.

    --
    ================================================== ======================
    Michael Kesti | "And like, one and one don't make
    | two, one and one make one."
    mrkesti at comcast dot net | - The Who, Bargain

  7. Re: How to use VxWorks ftpLib

    I did some debug today and found the following piece of codes:
    commandReply = ftpCommand(controlSocket_m, "TYPE I", 0, 0, 0, 0, 0, 0
    );
    The return code is 5, which means "FTP_ERROR". This caused the issue.
    But I can't figure out what's the root cause, because I don't know how
    the server reply back this value.

    Suggestions are welcome. Thanks!


  8. Re: How to use VxWorks ftpLib

    jeanwelly wrote:

    >I did some debug today and found the following piece of codes:
    > commandReply = ftpCommand(controlSocket_m, "TYPE I", 0, 0, 0, 0, 0, 0);
    >The return code is 5, which means "FTP_ERROR". This caused the issue.
    >But I can't figure out what's the root cause, because I don't know how
    >the server reply back this value.
    >
    >Suggestions are welcome. Thanks!


    The server might provide a logging facility that you can use to obtain
    more info, otherwise your best bet is probably to use a network sniffer
    to observe the traffic and see what the server is actually sending, if
    anything.

    --
    ================================================== ======================
    Michael Kesti | "And like, one and one don't make
    | two, one and one make one."
    mrkesti at comcast dot net | - The Who, Bargain

  9. Re: How to use VxWorks ftpLib

    The server is a Unix server. Does anybody know are there any logging
    utilities in Unix can be used for this kind of debugging. I heared the
    sniffer is a big one, how to use this tool? Any details about this? So
    I can googing for more information.
    Thanks!


  10. Re: How to use VxWorks ftpLib

    One thing more, I found code flow as below:
    ftpHookup - Correct
    -> ftpCommand(fdconn, "TYPE I", 0, 0, 0, 0, 0, 0 ); - Correct
    -> ftpDataConnInit( _controlSocket_m ); - Correct
    -> ftpCommand( _controlSocket_m, "STOR %s",..) - Error! Return 5

    The issue seems error occured when we write(maybe create) a new file in
    server.


  11. Re: How to use VxWorks ftpLib

    Hello jeanwelly ,
    jeanwelly schrieb:
    > One thing more, I found code flow as below:
    > ftpHookup - Correct
    > -> ftpCommand(fdconn, "TYPE I", 0, 0, 0, 0, 0, 0 ); - Correct
    > -> ftpDataConnInit( _controlSocket_m ); - Correct
    > -> ftpCommand( _controlSocket_m, "STOR %s",..) - Error! Return 5
    >

    Does the sequence work by hand from a PC/Unix account using the ftp client?

    --
    BaSystem Martin Raabe
    E: Martin.RaabeB-a-S-y-s-t-e-mde

  12. Re: How to use VxWorks ftpLib

    The latest updates for this issue:
    There are several accounts created in the FTP server, some can work
    correctly used in board. For the unsuccessful account, I can be used in
    my PC to access the server but couldn't be used in PPC target board to
    access the FTP server.


  13. Re: How to use VxWorks ftpLib

    Hello jeanwelly,

    jeanwelly schrieb:
    > The latest updates for this issue:
    > There are several accounts created in the FTP server, some can work
    > correctly used in board. For the unsuccessful account, I can be used in
    > my PC to access the server but couldn't be used in PPC target board to
    > access the FTP server.
    >

    So this means that you can do the exact same commands from PC and PPC on
    the correct accounts and you can't do the STOR command on the uncorrect
    accounts?

    --
    BaSystem Martin Raabe
    E: Martin.RaabeB-a-S-y-s-t-e-mde

  14. Re: How to use VxWorks ftpLib

    Hi all,

    I want to ftp a file from a remote FTP server (my PC) to a board
    running VXWORKS.
    I have a function that calls ftpXfer as follows,

    if ( ftpXfer ( "172.25.21.44", "anonymous", "password", "", "RETR
    %s", "C", "abc.txt", &hControlSocket, &hDataSocket ) == ERROR )
    {
    printf ("\nSome error in ftp\n");
    xfererror = TRUE;
    }
    else
    printf ("\nNo error in first part\n");
    if ( ( hControlSocket == -1 ) || ( hDataSocket == -1 ) )
    {
    printf ("\nSome socket is -1\n");
    xfererror = TRUE;
    }

    if (TRUE == xfererror )
    printf ("\nERROR\n");
    else
    printf ("\nNO ERROR\n");


    Occassionaly, I see the print Some error in ftp, whereas at most other
    times I get NO ERROR.

    However, if I ftp to the board, I find the file abc.txt missing (even
    in the NO ERROR case)

    Can anyone help?

    Thanks for your time...


  15. Re: How to use VxWorks ftpLib

    Hi all,

    Issue is solved

    I assumed that ftpXfer would transfer the file onto flash for me...
    gotta use the hDataSocket instead to do a read

    Pseudo code that works:

    if ( ftpXfer ( "172.25.21.44", "anonymous", "password", "", "RETR
    %s", "C", "abc.txt", &hControlSocket, &hDataSocket ) == ERROR )
    {
    printf ("\nSome error ...
    :
    :
    :
    if (TRUE == xfererror )
    printf ("\nERROR\n");
    else
    printf ("\nNO ERROR\n");

    // newly added code:
    // check if there was an error in starting the transfer... If not,
    while ((num = read (hDataSocket, buf, sizeof (buf))) > 0)
    {
    retval = fputs (buf, fp); // buf is the fd of the file of name abc.txt
    created in flash
    }
    // close fp, hControlSocket and hDataSocket

    Do let me know if you spot a flaw or know how to do this better.

    Thanks...


+ Reply to Thread