Lesson 02 concurrent server#2
Open
zeshhaan wants to merge 2 commits into
Open
Conversation
- Add TCP server that listens on port 4000 and handles single HTTP request - Implement core TCP lifecycle: listen, accept, receive, send, close - Add detailed comments explaining :gen_tcp options and flow - Update Elixir version requirement to 1.14 for compatibility This is the first step in learning Elixir by building an HTTP server from scratch. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Lesson 02: Concurrent TCP Server New Features: - Add accept_loop with tail recursion for infinite accept loop - Spawn isolated process for each client connection - Enable concurrent handling of multiple requests - Add comprehensive LEARNING.md documentation Key Concepts Demonstrated: - Elixir process spawning with spawn/1 - Tail call optimization (TCO) for infinite recursion - Process isolation (crashes don't affect other clients) - Concurrency pattern: accept → spawn → recurse immediately Technical Details: - Each client handled in separate process (~2KB memory) - accept_loop never waits for spawned processes - Processes exit naturally when request completes - Can handle thousands of concurrent connections Documentation: - Complete explanation of TCP, sockets, and HTTP - Detailed breakdown of recursion vs tail recursion - Step-by-step code walkthrough with timeline diagrams - Testing guide including Observer visualization - Comparison of Elixir processes vs OS threads 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.