why are there messy code in response after 'MLSD'?

Moderator: Project members

Post Reply
Message
Author
bingvnn
500 Command not understood
Posts: 1
Joined: 2015-05-28 14:24
First name: nam
Last name: nam
Contact:

why are there messy code in response after 'MLSD'?

#1 Post by bingvnn » 2015-06-10 02:12

i use following code to receive directory detail in data connection.

Code: Select all

 char dirList_buf[BUFFER_DATA];
   CString dirList;
   CString temp;
   do 
   {
      Sleep(SLEEP_TIME);
      temp="";
      memset((void*)dirList_buf, 0, BUFFER_DATA);
      result=recv(dataSocket, dirList_buf, BUFFER_DATA, 0);
      temp=dirList_buf;
      dirList+=temp;
   } while (temp.GetLength()>0);
i use 'recvCode' to indicate the code 'result=recv(dataSocket, dirList_buf, BUFFER_DATA, 0);'.

if data in the response of data connection after 'MLSD' sent is too big, then recvCode will execute two times. and then i find some messy code in dirList.

accurately the messy code is between the tail(tail of dirList_buf when recvCode execute firstly) and the head(head of dirList_buf when recvCode execute secondly) in dirList. whats going on?

look forward to your reply。

User avatar
botg
Site Admin
Posts: 33053
Joined: 2004-02-23 20:49
First name: Tim
Last name: Kosse
Contact:

Re: why are there messy code in response after 'MLSD'?

#2 Post by botg » 2015-06-10 08:00

Check your character set conversion. Don't convert partial UTF-8 sequences.

Post Reply