This is an excellent educational project. The code is clean and easy to understand. I probably wouldn't actually use it in production, cuz there's no checking for overruns, Etc. But as a way to learn what's actually involved in a web server I haven't seen a better example. I especially liked the binary search/ map
Well, obviously it is not anywhere near ready for being used in production. I just wanted to make this because it's a cool project and I learned a lot from it. I'm still learning and trying to improve on it. Thanks a lot for your support. It really means a lot
@ThatGuyJamal i have been learning rust recently and I have to say that openAI's chatGPT AI is really good at answering programming questions. I can copy paste errors I don't understand there and it will tell me what exactly it means, or I can ask it how to do something and it will provide a code snippet. Honestly has made learning like 5x easier.
Lvl 0 programmer: oh X is the best programming language because of reasons A, B, C Lvl 1 programmer: you should use the best tool for each job and not be dogmatic about any particular programming language Lvl 10 programmer: write it in C anyway lulz
I mean, everything I program is in C because I did not bother to learn another language and have other things to do in my life. Nice to hear that it makes me a lvl 10 programmer in your view though, haha.
That was the first exercise for the course operating systems in my Uni. We built a multithreaded server from scratch in c, utilizing pthreads, signals, sockets, mutual exclusion for the db, and synchronization of the incoming requests using a FIFO queue. One of the best projects actually!
Good programmers choose the right tool for the job. Good programmers use an IDE, because they do understand the importance of using a debugger, so they can check the value of a variable without having to log it to the console, use watches, change values on the fly, debug step by step. Noobs use vim because they think it's cool and they believe programming is about how fast you can write the code because you can keep your hands on the keyboard. Also C in 2022 is a bad choice for anything, included low level programming, where C++ and Rust and Zig are a much better choice. Just a free advice from someone with 25 years of experience in the industry.
@@imraninfrarote in us uni they have networking and db. Indian syllabus has only algorithms and basics. I'm guessing you're Indian from geeksfromgeeks page.
The cool thing will be to get to a point where you can run a performance benchmark against stuff like apache iis and node express. Or even that new rust framework leptos
Pretty nice 🙂It remembers me the old days where we had to create lots of programs using C and C++ and we didn't have a nice editor with all the syntax highlighting and code completion... *sigh* But it was a lot of fun 🙂
If I had to implement route mapping I would suggest using a Trie. It is simpler than a balanced BST, has better time complexity and extending it to support common features like catch all routes (/catch-all/*) and slugs (/products/:slug:/p) is very straightforward.
If we were in the old days, we wouldn't be using C as you did but instead through a superserver, like inetd, and you could easily make a server using printf's, read() and write() to stdin/stdout (you could make a webserver with AWK or Shell script like this). Second, if you are already using unix sockets, you can use unix/posix functions, and there's regex in posix c. Fun fact: Even the UNIX "fathers" didn't like sockets (that came from BSD, not UNIX) but their solution was only done in Plan 9 through the /net directory, and they had to reinvent how file system works to make it work (and in the process they created private namespaces, which somehow creeped to linux as mount namespaces, and in linux the mount namespace is as powerful as private namespace of Plan 9, but everyone uses as only a gimick for isolating environments like chroots. This is sad, to be honest...)
This isn't just a learning project. As a backend developer (who loves C/C++ More than any other language) i am about to write my own web server using C++ (i use C++ instead of C just for tge OOP i don't use the STL i hate it) That's because most used web servers are open source and available for everyone, so hackers can download and start pentesting the webserver, potentially detecting an RCE vulnerablitity which puts all servers using this web server at risk. When we write our own PERSONAL web server, we'll avoid all types of server attacks (because our web server isn't available for hackers to pentest) and pentesting requires debugging, analyzing the source code, and so on.... This video is like a push to me to create my own web server that serves files, and execute backend scripts such as python, php, and javascript.
The reduction in penetration testing stops being so valuable when the server is running scripts, because of the increased chance of unsafe inputs slipping into the interpretter.
@@absalomdraconis 100%, That's Why Im Going to mirror user input through multiple input validation bridges inside the server itself before throwing it to the interpreter.
i worked as a software developer in Embedos Engineering in Mumbai India, here we use to make IOT edge devices with SBC's and Microcontrollers. We used Esp32 and wrote our own code in C from scratch created web servers to achieve 2 way communication between the device and the end user for device configuration and data visualization, can connect to the device once in the same network just get the IP of esp32 it serves html files stored in it (esp32).
Great Video! Well if you want to try this again, but with an easier to use API, C has GLib+GIO (spun off from the GTK project) which you can use to write all of this in Pure C. GLib can provide pre-built data structures (yes, it has Hash Maps), and GIO which provide a high level File and Socket API including streams, all in Pure C. (Note, GLib and GIO DOES NOT depend on GTK, you can import them independently).
Jesus Christ, not only is he writing C code in VIM but he is also using Linux, not any Linux distro, but an RPM based distro. 👏🏾👏🏾👏🏾 a fellow man of culture, Based.
In my experience, the best way to learn a programming language (or programming in general) is to simply build stuff with it. It doesn't have to be the next big thing. When I started coding I went nuts and built tons of questionable programs.
back in the uni, my prof said only an idiot will use C to develop a web server. And that what I also did. I am so glad that I am not the only idiot in this world :D
The beej network guide is great for this if anyone wants to try or learn it. It's a good overall guide for new people. Now just need to learn parallel/concurrent programming...
Really fun video, mate! I am subscribing! Liked how you forget to regord once and at the begining as you said that you didn't copy the code from the YT tutorial 😂😂
@@imraninfrarote A nightmare? Nah. I've been programming in C for 3 decades, and I prefer it. So do the developers of virtually every other systems developer.
@@yapdog well, I clearly don't have experience like you do. So a huge portion of the time, I'm not even sure what I'm looking for. I will strive to be efficient in systems programming as it is something that truly interests me
@@imraninfrarote Coolness 😎 I'll try to keep up on your progress, but I'm sure I'm sure I'll learn a thing or three along the way. You're never too old to learn something new, right?
I fought with Javascript for a long time, until I understood it. I don't say I agree with implementation but I think I understand it, funny to see juniors fight with code that should work but it doesn't))
Really So much impressed brother and i myself like C Language and want to make my FYP project in C. The C Language is best for beginners that wants to learn programing. Actually from C or C++ you understand and learn alot of basic concepts of programing which i think most of the programers still dont understand clearly and that is the reason for their poor cpde quality. Looking forward for more informative videos from you :)
It was out of fear for this day that browser developers didn't allow the remote execution of C code.
...so they made an architecture called WebASM that C can compile to.
@@andrewporter1868 Yes
u use vim u alredy have no respect from react komunity
Hello channel deleted, i’m deleted too😅
@@andrewporter1868 XD
This is an excellent educational project. The code is clean and easy to understand. I probably wouldn't actually use it in production, cuz there's no checking for overruns, Etc. But as a way to learn what's actually involved in a web server I haven't seen a better example. I especially liked the binary search/ map
Well, obviously it is not anywhere near ready for being used in production. I just wanted to make this because it's a cool project and I learned a lot from it. I'm still learning and trying to improve on it. Thanks a lot for your support. It really means a lot
@ThatGuyJamal for me, rusts "the book" is a wonderful introduction. Rust as in the language
@ThatGuyJamal i have been learning rust recently and I have to say that openAI's chatGPT AI is really good at answering programming questions. I can copy paste errors I don't understand there and it will tell me what exactly it means, or I can ask it how to do something and it will provide a code snippet. Honestly has made learning like 5x easier.
LGTM!
what is overrunss and why are they bad?
Lvl 0 programmer: oh X is the best programming language because of reasons A, B, C
Lvl 1 programmer: you should use the best tool for each job and not be dogmatic about any particular programming language
Lvl 10 programmer: write it in C anyway lulz
Lvl 69:
Use python for work
Use C and shit on python on yt
I mean, everything I program is in C because I did not bother to learn another language and have other things to do in my life.
Nice to hear that it makes me a lvl 10 programmer in your view though, haha.
@@alefratat4018 that makes you level 0 though.
@@alefratat4018 you act like it takes a REALLY long time to learn a new language. That's definitely not the case, especially if you know c.
@@imraninfrarote pñ
That was the first exercise for the course operating systems in my Uni. We built a multithreaded server from scratch in c, utilizing pthreads, signals, sockets, mutual exclusion for the db, and synchronization of the incoming requests using a FIFO queue. One of the best projects actually!
It's really such an interesting topic to dive into. I mean all the stuff that we (web developers) take for granted, it's just mind boggling.
tell me where you went to college, at mine we didn't go beyond a simple cashier system. xD
@@bryanherreradev8055 I studied computer science and engineering at the university of Ioannina, Greece.
Can you mention the recourses/essential-readings and any other kind of useful materials that were listed in your course descriptor of this module?
Would love to take a read at those materials too if you still have it
For anyone looking to do this in production (I reduced my AWS bill by switching from Python to C/GO), I can recommend Ulfius or libonion
What was there? Web app or just serving static?
By how much (percentage is fine) have you reduced your AWS bill and could you share with us what is your application like at a high level?
For anyone looking to do this in production, I recommend therapy
@@peq42_ Is that library? Or pun intended.
@@peq42_ based
My man using C and Vim? Absolute god-tier programmer. I aspire to be as based as this one day
Good programmers choose the right tool for the job. Good programmers use an IDE, because they do understand the importance of using a debugger, so they can check the value of a variable without having to log it to the console, use watches, change values on the fly, debug step by step. Noobs use vim because they think it's cool and they believe programming is about how fast you can write the code because you can keep your hands on the keyboard. Also C in 2022 is a bad choice for anything, included low level programming, where C++ and Rust and Zig are a much better choice. Just a free advice from someone with 25 years of experience in the industry.
@@biomorphic cope
@@biomorphic Ever heard of GDB? real men only use the terminal
@@biomorphic As an ex-dev in over 3 FAANG & FORTUNE 50 companies, I absolutely agree.
@@biomorphic I'd just say to use emacs or vscode with vim keybinds
I freaking love that coding kind of imbues us with this chaotic energy that makes us do *whatever* because we can 😂😂😂
We actually had this as an assignment in our computer science course at uni and I found it a great learning experience for both C and HTTP/IP
I'm not sure if our networking course has this project/assignment. But it would be cool to have this
Same
@@imraninfrarote in us uni they have networking and db. Indian syllabus has only algorithms and basics. I'm guessing you're Indian from geeksfromgeeks page.
COMP30023 "Computer Systems" at the University of Melbourne for anyone wondering
I'm actually Bangladeshi
The cool thing will be to get to a point where you can run a performance benchmark against stuff like apache iis and node express. Or even that new rust framework leptos
That's actually on my todo list. But for now, I'm just trying to get the basics done
until you get near feature parity, benchmarks aren't very useful, so that will be a long while off
leptos is a full stack framework. axum would be a more apt comparison.
Writing an multi threaded web server using only std is literally the main example in the Rust book 💀💀💀
Only 121 subs ? I thought this was already a big tech channel 😮 Keep going !
same
Appreciate the support mate
😶 okk you got a sub
484 now lol
@@billowen3285 696 now
Pretty nice 🙂It remembers me the old days where we had to create lots of programs using C and C++ and we didn't have a nice editor with all the syntax highlighting and code completion... *sigh* But it was a lot of fun 🙂
Now we get to create programs in c but with syntax highlighting and code completion !
Bro this was awesome. I would absolutely love to see more of these web servers in C series. Also, you have inspired me to try this myself :)
Bro could you explain how to run this project
The project is interesting, I did the same for a tp at the university. Once you do one of these you really understand how the web works
That's one of the main reasons I wanted to make this in the first place
The C language is one of the most important human developments of the last 50 years.
you know this guy is the real deal when he uses geeks for geeks
honestly I feel like 50% of C's problems would be solved if arrays just knew their own fucking length
If I had to implement route mapping I would suggest using a Trie. It is simpler than a balanced BST, has better time complexity and extending it to support common features like catch all routes (/catch-all/*) and slugs (/products/:slug:/p) is very straightforward.
Interesting. I was actually wondering how I'd handle slugs and stuff. I'll definitely take a look at it. Thanks for suggesting
freshers: we use chatgpt
experienced: we u se documentation
legends: I code in c
As someone who has also done this, I can say it was pretty darn fun.
But can you do it in FORTRAN?
I really wonder if anything can be done in any language. Like...can you do a website with cobol? Or a rest API with assembly, etc
This guy sleeps on the warm side of his pillow.
How could you tell?
If we were in the old days, we wouldn't be using C as you did but instead through a superserver, like inetd, and you could easily make a server using printf's, read() and write() to stdin/stdout (you could make a webserver with AWK or Shell script like this). Second, if you are already using unix sockets, you can use unix/posix functions, and there's regex in posix c.
Fun fact: Even the UNIX "fathers" didn't like sockets (that came from BSD, not UNIX) but their solution was only done in Plan 9 through the /net directory, and they had to reinvent how file system works to make it work (and in the process they created private namespaces, which somehow creeped to linux as mount namespaces, and in linux the mount namespace is as powerful as private namespace of Plan 9, but everyone uses as only a gimick for isolating environments like chroots. This is sad, to be honest...)
So you're suggesting you can do communication across the network via mounting?
@@spaghettiking653 on plan 9 yes, but only because plan 9 treat fs differently. all fs in plan 9 works like FUSE on linux/macos.
Here before 1mil views. Good job man!
dude the "0 hours and 69 minutes" really got me LMAO
This video remembered me, why I prefer using c# instead of its ancestors 😁
@Peter Brown for sure. Being fast is important in many fields. But I'm just to lazy to fight with all the struggle which is the cost for speed
Love the humour. I have done large projects using the Websockets API ... fun fun fun!
I remember watching this vid 1 year ago, beeing like, who tf would do that in c....
Year 2 in uni, implement an async server in c....
I hate my life..
I left a like and a comment to promote this video. Good stuff, keep it up, add more details
Thanks a lot 😊
Really appreciate the support
This isn't just a learning project.
As a backend developer (who loves C/C++ More than any other language) i am about to write my own web server using C++ (i use C++ instead of C just for tge OOP i don't use the STL i hate it)
That's because most used web servers are open source and available for everyone, so hackers can download and start pentesting the webserver, potentially detecting an RCE vulnerablitity which puts all servers using this web server at risk.
When we write our own PERSONAL web server, we'll avoid all types of server attacks (because our web server isn't available for hackers to pentest) and pentesting requires debugging, analyzing the source code, and so on....
This video is like a push to me to create my own web server that serves files, and execute backend scripts such as python, php, and javascript.
The reduction in penetration testing stops being so valuable when the server is running scripts, because of the increased chance of unsafe inputs slipping into the interpretter.
@@absalomdraconis 100%, That's Why Im Going to mirror user input through multiple input validation bridges inside the server itself before throwing it to the interpreter.
> i don't use the STL i hate it
lol..
Security through obscurity is not security.
@@levyroth why bro
What a nice neat little project. The code is easier to understand than I thought.
i worked as a software developer in Embedos Engineering in Mumbai India, here we use to make IOT edge devices with SBC's and Microcontrollers. We used Esp32 and wrote our own code in C from scratch created web servers to achieve 2 way communication between the device and the end user for device configuration and data visualization, can connect to the device once in the same network just get the IP of esp32 it serves html files stored in it (esp32).
One option for the routing map would be a trie structure, might be a bit better than a bst
This is such a good video, I see your channels gonna explode with content. You won my sub.
Nice style kinda like liveoverflow.
Now that AI can write code, *everything* should be written in C
Great Video!
Well if you want to try this again, but with an easier to use API, C has GLib+GIO (spun off from the GTK project) which you can use to write all of this in Pure C. GLib can provide pre-built data structures (yes, it has Hash Maps), and GIO which provide a high level File and Socket API including streams, all in Pure C. (Note, GLib and GIO DOES NOT depend on GTK, you can import them independently).
Amazing video. You rickrolled me. +Respect
A cool project but I enjoy having a good mental health
Basically my day job sockets, epoll, clone and so on.
When he said python garbage , my context manger got pissed .
Jesus Christ, not only is he writing C code in VIM but he is also using Linux, not any Linux distro, but an RPM based distro. 👏🏾👏🏾👏🏾 a fellow man of culture, Based.
have fun migrating it all to epoll, see you next autumn
that "different types of NaN" + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAH cracked me up xDDDDDDDDDDDd
1:55 ordered maps are most often B-trees for cache efficiency
Zero hours and 69 minutes 😂
This has to be a memory overflow
We had to build a web server in C for a network programming project at university. This was in 2005.
Wonderful work, I appreciate your humility. I'm excited to see where it goes!
Your data is gonna race faster than Bolt
I loved the video, I'm still a newbie in C but I'll definitely try something like this !
In my experience, the best way to learn a programming language (or programming in general) is to simply build stuff with it. It doesn't have to be the next big thing. When I started coding I went nuts and built tons of questionable programs.
Don’t until you really know what you’re doing
rip 💀💀
back in the uni, my prof said only an idiot will use C to develop a web server. And that what I also did. I am so glad that I am not the only idiot in this world :D
"It ain't that much"
Brah, that's C!
LOL! The rick roll really got me!! xD
Awesome content homie!
When the "C" character come out in intro screen. I thought the next character is "#" :)))) crazy.
It's like his writing dna codes.
Part 2 - Building my own Javascript framework
Not a bad idea though. It'll be an absolute blast to dive that deep into the JS world
According to the legend, gods only programming in vim.
0 hours and 69 minutes, bro broke math
Nice project Dude!
Good luck and have fun 😊
Next logical step: Assembly
Don't post spoilers pls
@@imraninfrarote If POST os prohibited, it should return a 403 not a 200.
The most intense coffee you'll never need.
I write my web servers in rust. (crab rave intensifies)
Best I can do is write a basic window in WIN32 like it's stone age.
I wish you actually made a full tutorial on how to do this.
literal god move by imran here. asserting dominance over all the soy devs
good job brother. this motivated me to write same in python or c++
The beej network guide is great for this if anyone wants to try or learn it. It's a good overall guide for new people. Now just need to learn parallel/concurrent programming...
The memes level in this video is superb, 11/10
Really fun video, mate! I am subscribing!
Liked how you forget to regord once and at the begining as you said that you didn't copy the code from the YT tutorial 😂😂
Ima let my dog know he had a whole week of spending afternoons at the dog park because I used gRPC. Thank you from him in advance.
Has anybody actually been disappointed by getting Rick-Rolled?
"0 hours and 69 minutes of thinking"
nice work, C is fast, scary fast, emphasis on the scary especially in Prod
Forget prod. The development part itself is a nightmare
@@imraninfrarote A nightmare? Nah. I've been programming in C for 3 decades, and I prefer it. So do the developers of virtually every other systems developer.
@@yapdog well, I clearly don't have experience like you do. So a huge portion of the time, I'm not even sure what I'm looking for. I will strive to be efficient in systems programming as it is something that truly interests me
@@imraninfrarote Coolness 😎 I'll try to keep up on your progress, but I'm sure I'm sure I'll learn a thing or three along the way. You're never too old to learn something new, right?
Meanwhile security laughing in corner
Security? Oh no he left the chat as soon as I turned on my pc
what i love the most about this is, that it is c and not c++.
"I used a BST cuz I didn't wanna roll my own HashMap" god I love rust
inb4 no_std killaz
A true sigma would write a Hash Table hahahahaha jk great work!
Average everforest theme enjoyer
Really good music choice lol
This is some sort of artistic endeavor.
In-depth tutorial is much appreciated. Like
I fought with Javascript for a long time, until I understood it. I don't say I agree with implementation but I think I understand it, funny to see juniors fight with code that should work but it doesn't))
me imagining sigma rule music in my head
That was a great idea. I will try to it on my own as well.
This is what I call a Real G
Really So much impressed brother and i myself like C Language and want to make my FYP project in C.
The C Language is best for beginners that wants to learn programing. Actually from C or C++ you understand and learn alot of basic concepts of programing which i think most of the programers still dont understand clearly and that is the reason for their poor cpde quality.
Looking forward for more informative videos from you :)
Very cool. `set number relativenumber` is the only way to fly
If you haven't set relativenumber (even if you don't use it to jump) what the hell are you doing with your life?
i don’t even `set number`. and i disable syntax highlighting
Hahaha you are a crazy man. Good job!!!
I was actually researching this topic at one point. Glad to see I'm not the only one who should be put in an institution.
bro so pro making the impossible possible in 3 minutes
The Rickroll : perfectly timed😩😂
Would be a great programming assignment for a university course
fing rick roll following me every where
When the web developer is 15 year old from inside
I know it was meant to be a joke - you know, shitting on C - but it's a fantastic language.
It absolutely is!
I mean C for me is true computer science language. All those low level details you learn while working with C is just mind blowing.
Cool. Now do it in assembly.
2:10
I C what you did there
funny, every unix function is NOT error handled at all
Nice, next code a search engine in Assembly.
The best!!! ❤️Let's make web server in c++. 🙏