What are some programs every programmer should make at least once?

0
Mudassir Ali
Feb 10, 2020 05:57 AM 0 Answers
Member Since Dec 2019
Subscribed Subscribe Not subscribe
Flag(0)
Mudassir Ali
- Feb 10, 2020 05:57 AM

A web server.

I did this one Saturday morning nearly 20 years ago in Java when I was getting more familiar with Unix and TCP/IP and discovered that Java had classes for socket programming. It stands out in my mind as the single most enlightening few hours worth of programming I ever did.

Now, it was rather simple. But it included the basic ability to listen on a socket, parse an HTTP request to get the verb and the path, and send back a response. Initially that was a static “Hello” or something like that, and then it was a file as specified by the path.

I then threw something like 10 simultaneous requests at it and promptly crashed it. So then I tweaked it a bit with multiple threads. Then threw more of a load at it, crashed it again. So started thinking about caching, managing memory usage while reading in the file contents and preparing the response etc.

I learned so much that morning – it was like lifting the lid on the Internet and going “ahhhh! so that’s how it all works!”

(bonus points for writing a load generator to help you crash said web server… 🙂 )

Reply on This
Replying as Submit
0 Subscribers
Submit Answer
Please login to submit answer.
0 Answers