1 for(;;){ 2 socklen_t len = sizeof(client_address); 3 connfd = accept(listenfd, (struct sockaddr *)&client_address, &len); 4 if(connfd < 0){ 5 printf("accept error: %s ", strerror(errno)); 6 } 7 printf("server get connection from %s ", inet_ntop(AF_INET, &client_address.sin_addr, buff, sizeof(buff))); 8 9 if((n = read(listenfd, message, 1024)) == -1){ 10 printf("read error: %s ", strerror(errno)); 11 exit(1); 12 } 13 message[n] = '