why are there messy code in response after 'MLSD'?
Posted: 2015-06-10 02:12
i use following code to receive directory detail in data connection.
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。
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);
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。