From 410c540233e5227eafa601edded68f5f945cf9dd Mon Sep 17 00:00:00 2001 From: fumiama Date: Mon, 3 May 2021 00:24:27 +0800 Subject: [PATCH] debug --- client.c | 4 ---- server.c | 6 +----- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/client.c b/client.c index 265d4d7..22a2d5e 100644 --- a/client.c +++ b/client.c @@ -47,10 +47,6 @@ int main(int argc,char *argv[]) { //usage: ./client host port ssize_t numbytes; puts("break!"); while((sockfd = socket(AF_INET,SOCK_STREAM,0)) == -1); - #if !__APPLE__ - int reuse = 1; - setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof(reuse)); - #endif puts("Get sockfd"); their_addr.sin_family = AF_INET; their_addr.sin_port = htons(atoi(argv[2])); diff --git a/server.c b/server.c index 217d3bf..782d7ff 100644 --- a/server.c +++ b/server.c @@ -78,10 +78,6 @@ int bindServer(uint16_t port, u_int try_times) { bzero(&(server_addr.sin_zero), 8); fd = socket(AF_INET, SOCK_STREAM, 0); - #if !__APPLE__ - int reuse = 1; - setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof(reuse)); - #endif while(!~(result = bind(fd, (struct sockaddr *)&server_addr, struct_len)) && fail_count++ < try_times) sleep(1); if(!~result && fail_count >= try_times) { puts("Bind server failure!"); @@ -140,7 +136,7 @@ int sendAll(char* file_path, THREADTIMER *timer) { hdtr.hdr_cnt = 1; sendfile(fileno(fp), timer->accept_fd, 0, &len, &hdtr, 0); #else - send(timer->accept_fd, &file_size, sizeof(uint32_t), 0); + //send(timer->accept_fd, &file_size, sizeof(uint32_t), 0); sendfile(timer->accept_fd, fileno(fp), &len, file_size); #endif printf("Send %lld bytes.\n", len);