Skip to content

filipebafica/web_server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

web_server

A web_server in C++

Start
|
|--> Create server socket
|    |
|    |--> Setup server address
|    |
|    |--> Bind server socket to address
|
|--> Prepare server socket to accept calls
|
|--> Loop (while true)
|    |
|    |--> Update list of file descriptors to poll
|    |
|    |--> Poll for events on file descriptors
|    |    |
|    |    |--> If pollEvents() == -1
|    |    |    |
|    |    |    |--> Print error message
|    |    |    |--> Continue loop
|    |    |
|    |    |--> Check if server socket has events (new client connection)
|    |    |    |
|    |    |    |--> If yes
|    |    |    |    |
|    |    |    |    |--> Accept new client connection
|    |    |    |
|    |    |    |--> Handle requests from existing clients
|    |    |    |    |
|    |    |    |    |--> Loop over client sockets
|    |    |    |    |    |
|    |    |    |    |    |--> If client socket has POLLIN event
|    |    |    |    |    |    |
|    |    |    |    |    |    |--> Read request from client
|    |    |    |    |    |    |--> Process request
|    |    |    |    |    |    |--> Send response to client
|    |    |    |    |    |    |--> Close client socket
|    |    |    |    |    |    |--> Remove client socket from list
|
|--> Terminate program

🏫 42 École | 42 São Paulo

42 École is a network of tech schools spread around the world where anyone can learn how to code for free.
At 42 there are no teachers or classrooms, each student learns from and works with each other (peer-to-peer learning).
To see more go to https://www.42.fr/ and https://www.42sp.org.br/.

About

A web_server in C++

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •