Chinaunix首页 | 论坛 | 博客
  • 博客访问: 541481
  • 博文数量: 104
  • 博客积分: 4131
  • 博客等级: 上校
  • 技术积分: 1137
  • 用 户 组: 普通用户
  • 注册时间: 2009-07-31 15:05
文章分类

全部博文(104)

文章存档

2011年(13)

2010年(23)

2009年(68)

我的朋友

分类:

2010-06-02 20:29:12

#include "VxWorks.h"
#include "stdio.h"
#include "errnoLib.h"
#include "ftpLib.h"
#include "ioLib.h"
#define HOST "192.168.20.115"
#define USER "vxworks"
#define PWD "vxworks"
#define W_DIR "C:/TEMP"
#define RD_CMD "RETR %s" /*get file from ftp server*/
#define FILE "baoqunmin.txt"
void ftpopen()
{
 int ctrlSock;
 int dataSock;
 char buf[6];
 int nBytes;
 if(ERROR == ftpXfer(HOST, USER, PWD, "", RD_CMD, W_DIR, FILE, &ctrlSock, &dataSock))
 {
  printf("\r\n ftp connected failed!");
  return ;
 }
 while((nBytes = read(dataSock, buf, sizeof(buf))) > 0)
 {
  printf("\r\n it is [%s]", buf);
 }
 close(dataSock);
 if(ERROR == nBytes)
  printf("\r\nit is reading error.");
 if(ftpCommand(ctrlSock, "QUIT", 0, 0, 0, 0, 0, 0) == FTP_COMPLETE)
  printf("\r\nftp is completed");
 close(ctrlSock);
}
阅读(3258) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~