准备工作VC6
0 添加w s2_32
lib 到工程,如下图操作: 1
首先添加w insock 库到工程 2
添加lib 库文件 3
添加w s2_32
lib 切记用空格隔开 4
点击OK 即可 源代码: FTP_Client: #pragma comment( lib, "w s2_32
lib" ) #include #include #include #include #include #include #define TRAN_SUCCESS 1 //传输成功 #define SOCK_WSA_ERR (-1) //启动w insock 库失败 #define SOCK_CRSOCK_ERR (-2) //创建套接字失败 #define SOCK_BIND_ERR (-3) //绑定端口失败 #define SOCK_LISTEN_ERR (-4) //监听失败 #define SOCK_ACCEPT_ERR (-5) //等待连接失败 #define SOCK_SEND_ERR (-6) //发送数据失败 #define SOCK_CLOSE_ERR (-7) //关闭 SOCKET 失败 #define SOCK_RECVE_ERR (-8) //接受数据失败 #define SOCK_CONNECT_ERR (-10) #define FILE_ERR (-9) //文件错误 #define Other_ERR (0) //其他不明原因 #define SVR_PORT 6000 //服务器端口 #define SEND_BUFFER_SIZE 4096 //每次发送大小 #define RECV_BUFFER_SIZE 4096 //每次发送大小 struct Fileinfo { char fileName[50]; //文件名 int fileBl