20 months developing a web server in C

แชร์
ฝัง
  • เผยแพร่เมื่อ 19 ม.ค. 2025

ความคิดเห็น • 35

  • @emilparkka1156
    @emilparkka1156 10 วันที่ผ่านมา

    Good job Roy! Very impressive

  • @joshaldrinsario4421
    @joshaldrinsario4421 19 วันที่ผ่านมา +13

    Wow, this is a very new channel. Hope you achieve great success in the future.

  • @BlackBirdOverflow
    @BlackBirdOverflow 16 วันที่ผ่านมา +7

    Its hard for people to escape from the javascript frameworks spiral into the low level stuff, great work ❤❤

  • @alexeydmitrievich5970
    @alexeydmitrievich5970 17 วันที่ผ่านมา +6

    You should not use sprintf with user- provided data. Use snprintf
    Sprintf and snprintf functions already add null terminator.
    The length of formatted string should be found not by strlen(), but by using the return value of sprintf

    • @dev.roysalazar
      @dev.roysalazar  17 วันที่ผ่านมา +3

      @@alexeydmitrievich5970 For sure I need to up the security 🙂 but the reason I don't use snprintf it's because it's not available in ANSI C. I use that version of C because of simplicity th-cam.com/video/443UNeGrFoM/w-d-xo.htmlsi=4bWn3YqXHqFtnbOb

  • @OhhBabyATriple
    @OhhBabyATriple 17 วันที่ผ่านมา +1

    Wow- this is insane

  • @HWeingard
    @HWeingard 16 วันที่ผ่านมา +3

    Did you implement a dictionary without hashing for your environment? Curious as to way you chose to do it that way.

    • @dev.roysalazar
      @dev.roysalazar  16 วันที่ผ่านมา +2

      I did! The main reason was to optimize for memory locality and reduce the number of instructions sent to the CPU. Given that the dataset in this case remains relatively small, this approach provides better performance. If the dataset were expected to grow significantly larger, I would have opted for a traditional hash table for better scalability.
      This kind of low-level control is the sort of freedom you lose in higher-level languages.

  • @jannes6666
    @jannes6666 18 วันที่ผ่านมา +4

    Nice vid. Is the voice really AI tho?
    If yes, what tool did you use?

    • @dev.roysalazar
      @dev.roysalazar  18 วันที่ผ่านมา +2

      @@jannes6666 I used elevenlabs.io for the AI voice

    • @LeighBriody
      @LeighBriody 17 วันที่ผ่านมา +2

      I had no idea, now I cannot unhear it

    • @noertri618
      @noertri618 13 วันที่ผ่านมา

      @@dev.roysalazar wait this voice use ai??

    • @dev.roysalazar
      @dev.roysalazar  13 วันที่ผ่านมา

      @@noertri618 yep

  • @dimitrobest5293
    @dimitrobest5293 13 วันที่ผ่านมา

    did you try Vlang

    • @dev.roysalazar
      @dev.roysalazar  13 วันที่ผ่านมา

      @@dimitrobest5293 I haven't. I would love to try Jai when it comes out though.

  • @keshavkumar1843
    @keshavkumar1843 18 วันที่ผ่านมา +7

    Can u teach us? In more detail?

    • @dev.roysalazar
      @dev.roysalazar  18 วันที่ผ่านมา +6

      Yes, I would like that. I am thinking, though, about what would be a good method. 🤔 Maybe I could invite someone with no previous experience in C to walk through the project with me. They could ask any questions they have, giving me fresh eyes on the project.

    • @keshavkumar1843
      @keshavkumar1843 18 วันที่ผ่านมา

      @dev.roysalazar that someone could be me since I know c but didn't developed any projects but I am currently doing my Masters so we have to talk about time. Also I am a python dev and I also always wonder how these things worked inside the hood. It would be really great If you gave us a walk through, also can we connect on socials?

    • @katelyn1475q
      @katelyn1475q 17 วันที่ผ่านมา +1

      ​@@dev.roysalazarIf you decide to go that path, I'd love to participate!

    • @JK11LL
      @JK11LL 17 วันที่ผ่านมา

      ​@@dev.roysalazarOh that's a great idea, I would love to participate

    • @racoon1258
      @racoon1258 11 วันที่ผ่านมา

      @@dev.roysalazar What an outstanding and ingenious idea! It would be an absolute honor to contribute or assist in this ❤🫡

  • @vintagewander
    @vintagewander 18 วันที่ผ่านมา +4

    Blazingly fast

    • @dev.roysalazar
      @dev.roysalazar  17 วันที่ผ่านมา +3

      For now all I can say is that my web server implementation requires fewer CPU instructions for handling requests compared to using something like Node.js, simply because it doesn't rely on the same number of levels of abstraction to perform the "same" task. But, my intention is for sure to eventually make it Blazingly fast! 🚀

  • @darshanrajpattanaik2154
    @darshanrajpattanaik2154 18 วันที่ผ่านมา

    The thing is that you created a great project, but you skipped a lot of things and assumed many things from your viewers such as knowing async architecture's implementation, why arenas are useful for memory management, and some linux sys calls, fork().
    It would be really great if you you dive deep into these things in a bit more detail so it allows us to understand the underlying workings.

    • @dev.roysalazar
      @dev.roysalazar  18 วันที่ผ่านมา +1

      I tried to make the video so that any software developer can grasp the basic idea, but I will create another video with more detail for those who want to dive deeper. Stay tuned!

  • @nevengeci8117
    @nevengeci8117 18 วันที่ผ่านมา

    why not use malloc and free?

    • @dev.roysalazar
      @dev.roysalazar  18 วันที่ผ่านมา +2

      I do use malloc/free in a couple of places where it makes sense to me, but you are likely wondering about the whole memory management method. Watch this video by Casey Muratori and it will make more sense why use a memory arena (instead of malloc/free everywhere) th-cam.com/video/xt1KNDmOYqA/w-d-xo.html

  • @lotuskshetri7832
    @lotuskshetri7832 18 วันที่ผ่านมา +3

    Web server in C 💀

    • @gamechannel1271
      @gamechannel1271 18 วันที่ผ่านมา +1

      Web server in Rust actually makes sense. There's libraries around it and you can get similar performance to C. That is, if you don't hate Rust's borrow system.

    • @dev.roysalazar
      @dev.roysalazar  18 วันที่ผ่านมา +5

      ​@@gamechannel1271 I intentionally move away from libraries and frameworks that make things quick and easy at the beginning but soon enough make your software much more complicated than it needs to be. Simplicity is my goal 🙂

    • @milasudril
      @milasudril 17 วันที่ผ่านมา

      @@gamechannel1271 I built a web server template/framework in C++. The hardest part
      * State tracking when processing requests
      * Exceptions. Are they a 400 or a 500? The full cause of the exception cannot be known in the catch block.
      I liked the epoll API though.

    • @Leonhart_93
      @Leonhart_93 17 วันที่ผ่านมา

      PHP is written in pure C and it's a massive project.

    • @Smudge5004
      @Smudge5004 16 วันที่ผ่านมา

      @@Leonhart_93 jvm its written in C++