FTP WinInet APIs Report Error 12003

本文介绍了使用WinInet FTP APIs连接非Microsoft FTP服务器时可能出现的错误12003的问题及其原因。此错误可能由于服务器返回了意外的状态码导致,WinInet未能正确解析这些消息。文章还提供了解决方案,即通过避免使用INTERNET_FLAG_PASSIVE标志来防止此类错误的发生。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Symptoms  
  Connection   to   a   non-Microsoft   FTP   server   with   WinInet   FTP   APIs   may   fail   with   error   12003.         

Cause  
  When   connecting   to   a   non-Microsoft   FTP   server   with   WinInet   APIs,   some   WinInet   FTP   APIs   may  fail   with   error   12003   (ERROR_INTERNET_EXTENDED_ERROR).   The  InternetGetLastResponseInfo   API   may   not   retrieve   any   Internet   specific   information.   This   error   may   occur   when   the   FTP   server   sends   an   unexpected   status   code   to   the   WinInet   client.   Please   note   that   this   may   not   indicate   an   error,   but   rather   the   server's   success   message   or  confirmation   (such   as   confirmation   of   getting   a   file,   sending   a   directory   listing,   and   so   forth).   In   some   cases   the   WinInet   FTP   APIs   may   not   parse   such   messages   correctly   and   erroneously   report   an   error.   This   may   happen   when   the   WinInet   FTP   APIs   are   used   to   connect   to   certain   VAX/VMS   FTP   servers. 

Resolution  
  The   above   behavior   may   be   avoided   by   not   using   the   INTERNET_FLAG_PASSIVE   flag   in   the   InternetConnect   or   InternetOpenUrl   API.   When   this   flag   is   not   used   WinInet   uses   active   semantics   for   the   FTP   connection,   which   avoids   the   return   of   the   status   code,   which   causes   the   parsing   problem.  

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值