Commit 9fe29c26 authored by Heiko Liermann's avatar Heiko Liermann
Browse files

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	chargen_server_TCP.c
parents f11d5958 fe07e107
......@@ -88,11 +88,20 @@ int main(int argc, char **argv) {
//constant LISTENQ for max number of connections
listen_wrapper(server_fd, LISTENQ);
struct sockaddr_in client;
int client_size = sizeof(client);
struct Args *thread_arguments;
thread_arguments = (struct Args *) malloc(sizeof(struct Args));
pthread_t thread_id;
while (1) {
client_fd = calloc(1, sizeof(int));
*client_fd = accept_wrapper(server_fd, NULL, NULL);
//cerate thread
pthread_create(&thread_id, NULL, *thread_handler, client_fd);
pthread_create(&thread_id, NULL, &thread_handler, client_fd);
......@@ -10,6 +10,13 @@ int main(int argc, char **argv) {
ssize_t len;
char buf[BUFFER_SIZE];
//getaddrinfo() returns one or more addrinfo structures,
// each of which contains an Internet address that can be specified
// in a call to bind(2) or connect(2). The getaddrinfo() function
// combines the functionality provided by the gethostbyname(3) and
// getservbyname(3) functions into a single interface, but unlike
// the latter functions, getaddrinfo() is reentrant and allows
// programs to eliminate IPv4-versus-IPv6 dependencies.
struct addrinfo *result, hints, *entry;
bzero(&hints, sizeof(hints));
......@@ -5,6 +5,7 @@
#include "Socket.h"
int main(int argc, char* argv[]) {
//Structure to contain information about address of a service provider.
struct addrinfo *result, *entry;
if (argc != 2) {
......@@ -15,7 +16,7 @@ int main(int argc, char* argv[]) {
int ret;
if ((ret = getaddrinfo(argv[1], NULL, NULL, &result))) {
fprintf(stderr, "Getaddrinfo: %s\n", gai_strerror(ret));
return 2;
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