안녕하세요
웹서버에 저장된 바이너리 파일을 다운로드 받으려고 합니다.
받는 방법은
./downloader saintlinu.org filename 이렇게 하면
웹서버의 / 에 저장된 filename을 가지고 오는 겁니다 ^_^
다음과 같이 처리했거든요
if( (fp = open(filename, O_WRONLY | O_TRUNC | O_CREAT)) < 0 ) {
perror("open");
exit(-1);
}
numbytes=0;
bzero(buf, sizeof(buf));
if( (numbytes=recv(sockfd, buf, MAX, 0)) < 0 ) {
perror("recv");