Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to use VxWorks ftpLib

1,185 views
Skip to first unread message

jeanwelly

unread,
Dec 26, 2005, 8:32:41 AM12/26/05
to
Hi, Buddies
I want to use ftp via ftpLib with account and password in vxWorks. How
can I implement this?
Thanks!

Michael R. Kesti

unread,
Dec 26, 2005, 11:19:58 AM12/26/05
to
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

jeanwelly

unread,
Dec 27, 2005, 7:34:38 AM12/27/05
to
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!

jeanwelly

unread,
Dec 27, 2005, 7:35:50 AM12/27/05
to

jeanwelly

unread,
Dec 27, 2005, 9:01:59 AM12/27/05
to
test

Michael R. Kesti

unread,
Dec 27, 2005, 11:43:56 AM12/27/05
to
jeanwelly wrote:

<wizard-of-oz>
Oh! Well, why didn't you say so in the first place?
</wizard-of-oz>

>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.

jeanwelly

unread,
Dec 27, 2005, 9:26:30 PM12/27/05
to
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!

Michael R. Kesti

unread,
Dec 27, 2005, 11:22:28 PM12/27/05
to
jeanwelly wrote:

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.

jeanwelly

unread,
Dec 28, 2005, 7:35:34 AM12/28/05
to
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!

jeanwelly

unread,
Dec 28, 2005, 7:44:25 AM12/28/05
to
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.

Martin Raabe

unread,
Dec 28, 2005, 10:36:38 AM12/28/05
to
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.Raabe<at>B-a-S-y-s-t-e-m<dot>de

jeanwelly

unread,
Dec 29, 2005, 6:43:24 AM12/29/05
to
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.

Martin Raabe

unread,
Dec 30, 2005, 1:44:39 AM12/30/05
to
Hello jeanwelly,

jeanwelly schrieb:

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?

QF

unread,
Dec 30, 2005, 6:38:24 AM12/30/05
to
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...

QF

unread,
Jan 2, 2006, 4:33:34 AM1/2/06
to
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...

0 new messages