Commit 561540f5 authored by Heiko Liermann's avatar Heiko Liermann
Browse files

- bugfix

parent 2a58ce01
......@@ -105,26 +105,6 @@ int shutdown_wrapper(int fd, int how) {
return i;
}
void *handle_connection(void *arg) {
ssize_t read_len, send_len;
char buf[BUFFER_SIZE];
int client_fd = *(int*)arg;
free(arg);
do {
read_len = recv_wrapper(client_fd, (void *) buf, sizeof(buf), 0);
send_len = 0;
while (send_len < read_len) {
send_len += send_wrapper(client_fd, (void *) (buf+send_len), read_len - send_len, 0);
}
} while(read_len > 0);
close(client_fd);
return 0;
}
......@@ -21,6 +21,7 @@
#include <time.h>
#include <sys/time.h>
#include <pthread.h>
#include <stdio.h>
int socket_wrapper(int family, int type, int protocol);
int bind_wrapper(int fd, const struct sockaddr *addr, socklen_t addrlen);
......@@ -34,6 +35,5 @@ int close_wrapper(int fd);
int shutdown_wrapper(int fd, int how);
ssize_t recvfrom_wrapper(int fd, void *buf, size_t buflen, int flags, struct sockaddr *from, socklen_t *addrlen);
ssize_t sendto_wrapper(int fd, void *buf, size_t buflen, int flags, const struct sockaddr *to, socklen_t addrlen);
void *handle_connection(void *arg);
#endif //NP_PRAKTIKUM2_SOCKET_H
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment