首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ Builder >

socket编程能正常连接但不能登录解决思路

2012-02-14 
socket编程能正常连接但不能登录我在c++builder6用socket与ftp服务器进行操作,能够建立连接,但是一直提示5

socket编程能正常连接但不能登录
我在c++builder6用socket与ftp服务器进行操作,能够建立连接,但是一直提示530 User username con not login.
但是有的服务器就能够正常登录。
不知道为什么,代码如下:
  String strRecv = "";

  MultiThreadDealSocket *dealSocket = new MultiThreadDealSocket();
  SOCKET client = dealSocket->GetConnect(host,port);
  strRecv = ReadLine(client);
  if(client == NULL) return NULL;

  String user = "USER "+userName+"\r\n";
  send(client,user.c_str(),user.Length(),0);
  strRecv = ReadLine(client);
  if(GetCode(strRecv) == "331")
  {
  String password = "PASS "+pass+"\r\n";
  send(client,password.c_str(),password.Length(),0);
  strRecv = ReadLine(client);//这里一直返回信息:530 User username con not login.
  }

[解决办法]
错啦,必需按照ftp协议,传送数据。

热点排行