help:有用C 写过FTP 程序的DX请进

_bobo 2004-06-29 10:11:07
下面FTP GET 的一段 程序来自己 palm os NetSample,但它只支持NON PASSIVE MODE
// Send the type command to put us into binary mode
StrPrintF(FTPCommand, "TYPE I ");
NetUWriteN(FTPCtlSock, (BytePtr)FTPCommand, StrLen(FTPCommand));
if (FTPGetReply(FTPCtlSock, &reply)) goto Exit;
f (reply >= 400) goto Exit;

// Create a data port to get the results
acceptSock = FTPDataAcceptSocket();
if (acceptSock < 0) return;

// Send the RETR command
StrPrintF(FTPCommand, "RETR %s ", argv[1]);
NetUWriteN(FTPCtlSock, (BytePtr)FTPCommand, StrLen(FTPCommand));

// Get Reply from the RETR command < r o l i a. n e t >
if (FTPGetReply(FTPCtlSock, &reply)) goto Exit;
if (reply >= 400) goto Exit;

addrLen = sizeof(address);
if ((dataSock = accept (acceptSock, &address, &addrLen)) < 0) goto Exit;
errno = FTPDatabaseRead(0, argv[1], dataSock);


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

Exit:
if (errno) printf(" Error: %s", appErrString(errno));
if (acceptSock >= 0) close(acceptSock);
if (dataSock >= 0) close(dataSock);

如果以PASSIVE MODE 工作,上边的程序该怎么修改?
...全文
151 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
nowaytolive 2004-07-27
  • 打赏
  • 举报
回复
BOBO,能不能共享一下你的所有代码? :)
mryinliang 2004-07-07
  • 打赏
  • 举报
回复
被动模式,自己的程序作为SOCKET的客户端连接到FTP服务器,从服务器读数据。
doomm 2004-07-05
  • 打赏
  • 举报
回复
不懂,帮你顶顶...
mailblock 2004-07-05
  • 打赏
  • 举报
回复
自己写FTP?

3,119

社区成员

发帖
与我相关
我的任务
社区描述
塞班系统(Symbian系统)是塞班公司为手机而设计的操作系统,它的前身是英国宝意昂公司的 EP ( Electronic Piece of cheese)操作系统。
社区管理员
  • Symbian社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧