Guest User

Untitled

a guest
May 5th, 2012
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. while(1) { // main accept() loop
  2. sin_size = sizeof their_addr;
  3. new_fd = accept(sockfd, (struct sockaddr *)&their_addr, &sin_size);
  4. if (new_fd == -1) {
  5. perror("accept");
  6. continue;
  7. }
  8. if(recv(new_fd, browserInput, sizeof browserInput, 0) == -1){
  9. perror("recv");
  10. }
  11.  
  12. printf("%s", browserInput);
  13.  
  14. if (fork() == 0) {
  15. sendPage();
  16. }
  17. close(new_fd); // parent doesn't need this
  18. }
Advertisement
Add Comment
Please, Sign In to add comment