|
n(-1);
}
//clean tmp
for(i=0;i<4;i++)
tmp='\0';
strncpy(tmp,buff,3);
if(strcmp(tmp,"220")!=0)
return (-1);
//send msgs. if any step has a mistake,
the "while" will be breaked,then send "quit" to end connection
i=EHLO;
while(i {
if((numbytes=send(sockfd,msg,strlen(msg),0))==-1)
{
perror("send error");
break;
}
//sleep(1);we dont have to use it,because recv() can
choke itself until it received data
if((numbytes=recv(sockfd,buff,SIZE,0))==-1)
{
perror("recv error");
break;
}
strncpy(tmp,buff,3);
//printf("command:%s\n",msg);
//printf("return buff:%s\n",buff);
//printf("should return:% 页码:[1] [2] [3] [4] [5] [6] [7] [8] [9] [10] 第8页、共10页 |