Skip to content

Alec-Phillips/TCP-web-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TCP Secure Web Server

By Christopher Linscott, Alec Phillips, Joey Rose

A simple, web server made with TCP Web Sockets.

To get things setup,

  • Fork this repository
  • Clone it into your working directory
  • You're good to go!

To initialize a web server on your device,

  • Navigate to /server-and-client/server.c in your terminal
  • Run gcc server.c -Wall -o se
  • Run /se {portNumber} and you should see it begin listening on the given server port.
    • Ex: /se 2000 will run a web server on port 2000.

Two ways to connect to said web server:

  • Use the browser!

    • A normal GET Request will look something like: http://localhost:{portNumber}/{path to file from root}
      • Ex: http://localhost:1000/desktop/dogs/cat.html will attempt to GET a file called cat.html in the folder named 'dogs' (which is a subdirectory of 'desktop').
  • However, in general (and for PUT and DELETE Requests), I highly recommend Postman. But, PUT Requests are possible in the browser as well.

    • For both, it requires using query params (or basically writing in the URL), and a request body (for the data we want in the file).
    • Example in Postman:
      • Screen Shot 2021-10-31 at 11 19 11 AM
    • We will now see the data here in our file system at /desktop/dogs/cat.html:
      • Screen Shot 2021-10-31 at 11 20 35 AM
  • Use the client side

    • Initalize another terminal
    • Run gcc client.c -Wall -o ce
    • Run ./ce {portNumber} and you should see it connect (if the server is running), asking for a HTTP Request.
      • Example HTTP Requests (there are issues currently with copy and paste :/) :
        • GET /desktop/cats/dogs.html HTTP/1.1
          Host: localhost:2000
          Connection: keep-alive
        • PUT /desktop/cats/dogs.html HTTP/1.1
          Host: localhost:2000
          Connection: keep-alive

          This is some cool file data! (◕‿◕)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages