diff --git a/srcs/Webserv.cpp b/srcs/Webserv.cpp index ba7fd54..a4f426d 100644 --- a/srcs/Webserv.cpp +++ b/srcs/Webserv.cpp @@ -35,7 +35,6 @@ void Webserv::bind(in_port_t port) { ::perror("err bind(): "); throw std::runtime_error("Socket bind"); -// std::cerr << "error bind\n"; } } diff --git a/srcs/main.cpp b/srcs/main.cpp index 31bd27f..caea669 100644 --- a/srcs/main.cpp +++ b/srcs/main.cpp @@ -1,7 +1,6 @@ /* luke version -*/ #include #include @@ -25,16 +24,19 @@ int main(void) } return (0); } +*/ /* wip hugo version +*/ # include # include # include - # include // close # include // fcntl +# include // close +# include // exit # include // cout, cin # include // errno # include // perror @@ -45,8 +47,9 @@ int main(void) # include // poll # define INVALID -1 -# define PORT 1025 # define BACKLOG 20 +// test with curl http://localhost:PORT (replace PORT by the port number you choose below) +# define PORT 4040 int main() { @@ -114,10 +117,19 @@ int main() std::cout << "server accepted a socket from: " << inet_ntoa(their_addr.sin_addr) << "\n"; - break; + + // // with a fork + // if (!fork()) // child process + // { + // close(sckt_fd); // child doesn't need the listener + // if (send(axpt_fd, "hello world !", 13, 0) == INVALID) + // perror("err send(): "); + // close(axpt_fd); + // exit(0); + // } + // close(axpt_fd); // parent doesn't need this } return 0; } -*/ diff --git a/webserv b/webserv index 8df53b3..eb88ea0 100755 Binary files a/webserv and b/webserv differ