Description: In this video we continue coding our "Hello World" server. We will now encounter the most important API call - accept() ( from a server's perspective ). Accept() allows the server process to accept client connections and process them. We will currently run the server in an infinite loop, so that we can process clients one after the other. The important thing to note here that this server process is not multithreaded and thus can only process a single client at a time. To be able to process multiple clients asynchronous calls such as select() or multithreading will have to be used. Links:<br><br>1. Beej's Socket Programming guide<br><br>2. Client Server programming using sockets<br><br>3. Unix Network Programming<br><br>4. Raw Socket programming basics<br><br>
Tags: programming ,
Disclaimer: We are a infosec video aggregator and this video is linked from an external website. The original author may be different from the user re-posting/linking it here. Please do not assume the authors to be same without verifying.
Hello, I am very new to programming. I follow along and all works, but only after I get rid of the printing of the client addr.
For this line:
printf("Sent %d bytes to client : %s\n", sent, inet_ntoa(client.sin_addr));
I get:
HelloServer.c:49: warning: format ‘%s’ expects type ‘char *’, but argument 3 has type ‘int’
I type client as the sockaddr_in struct:
struct sockaddr_in server, client;
which gets "populated" by the accept:
if((cli = accept(sock, (struct sockaddr *)&client, &len)) == -1)
What am I doing wrong?
Thanks! and great vids!! you need to link to part 2 from part 1 though.