Skip to content

TCP server built from scratch using raw sockets in Go lang, which istens to a port, accepts connections, reads requests, processes them, sends responses, and closes connections.

Notifications You must be signed in to change notification settings

sujay2306/multi-threaded-tcp-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 

Repository files navigation

multi-threaded-tcp-server

This Go TCP server accepts incoming connections, processes basic HTTP requests, and sends back responses. The server demonstrates key concepts like socket programming and system calls. It handles incoming connections, reads requests, processes them, and sends responses. However, the initial version of the server could only handle one connection at a time due to its single-threaded nature.

Key Concepts

  • Raw Socket Programming:
    The server uses Go’s net package to create a TCP socket and listen for incoming connections.

  • System Calls:
    The server interacts with the operating system to accept connections, read requests, and send responses.

  • Basic HTTP Handling:
    The server reads simple HTTP requests and sends back basic HTTP responses.

  • Single-threaded Limitation:
    The server processes requests one by one and can’t handle multiple connections simultaneously.

  • Concurrency with Goroutines:
    To improve performance, the server uses goroutines (Go's lightweight threads) to handle multiple requests at the same time.

Sequencial Processing

seq.mov

Parallel Processing

parallel.mov

About

TCP server built from scratch using raw sockets in Go lang, which istens to a port, accepts connections, reads requests, processes them, sends responses, and closes connections.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages