n't open the file: %s\n", buff);
exit(1);
}
while(count = read(connfd, buff, BUFFERSIZE)) {
if (count < 0) {
fprintf(stderr, "connfd read error\n");
exit(1);
}
if (writen(filefd, buff, count) < 0) {
fprintf(stderr, "writing to filefd error\n");
exit(1);
}
}
Close(filefd);
Close(connfd);
printf("file %s received!\n", filename);
}
Close(listenfd);
//////////////////////////////////////////////////////////
return 0;
}
________________________________________________________________________