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

Unable to transfer file from target to host using TFTP

501 views
Skip to first unread message

Vikas

unread,
Dec 2, 2003, 6:39:31 PM12/2/03
to
Hi All,

Using VxWorks 5.5 and Tornado 2.2 , I FAIL TO transfer a file from
target to host using TFTP. Of course, the TFTP Client is included in
my target VxWorks image and TFTP server is running on the windows
host.


I use the following code......


fd1 = open("/usr/log1",O_CREAT| O_RDWR ,0777);


actualBytes = write(fd1,"Hi there\n",10);

printf("bytes written to file =%d \n",actualBytes);

actualBytes = write(fd1,"hello again",12);

printf("bytes written to file =%d \n",actualBytes);

if(ERROR == tftpCopy("192.168.1.1",0,"C:\\tftpDir\\log1.txt","put","ascii",fd1))
{
printf("Error while putting file on Host\n");
}


O/p of printf indicates that the correct number of bytes are written
to the file.

A file called log1.txt does get created in the specified directory
( C:\tftpDir\ ) in the windows m/c but it is empty ( size is 0
bytes).This proves that it is not a "access permissions" problem.

The call to tftpCopy doesn't return an ERROR, but somehow the file is
not transferred correctly.I'm not even sure that the file gets created
properly on the target.
Do I need to have a full-blown Target File System in place before I
create files like this ? I observe this problem both when I include
and exclude dosFs2 in my VxWorks build.

Any clarifications/inputs will be greatly appreciated

Thanks,
Vik

joe durusau

unread,
Dec 3, 2003, 8:16:47 AM12/3/03
to

Vikas wrote:

The function is intended to transfer files between a target and
a server. The file name you used for fd1 appears to be a file
on a development host. Perhaps you need to clarify the
exactly what ype of target you are using. The fd in the
last parameter of the command is intended to be local to
the target, so you need dosfs or some other filesystem on the
target for this to work. Also, you are not closing the file
after you write to it. On DOS filesystems, you cannot
read the file until after it is closed after writing it. Any of these
might be your problem. Then again, there might be something
else wrong, as I am no expert on tftp.


Speaking only for myself,

Joe Durusau


SGH1

unread,
Dec 2, 2003, 9:15:01 PM12/2/03
to VxWorks Users Group List
Hi, All

I want to do ICQ with ALG like ftp in NAT. Is anyone has some ideas about
ICQ port negotiation before file transfer, or ICQ packet's format?

Thanks a lot for your help !
Shao Guohau

Amogh Kavimandan

unread,
Dec 3, 2003, 11:09:45 PM12/3/03
to vxwe...@csg.lbl.gov

> Hi All,
>
> Using VxWorks 5.5 and Tornado 2.2 , I FAIL TO transfer a file from
> target to host using TFTP. Of course, the TFTP Client is included in
> my target VxWorks image and TFTP server is running on the windows
> host.

if you don't *have* to use tftpcopy() etc., you may use tftpXfer(...)
which I found is a lot cleaner way to achieve the same thing.

0 new messages