How Does Go Support Network and Socket Programming?
Go's net package offers TCP, UDP and Unix sockets with goroutines per connection. Learn deadlines, framing, graceful shutdown and common pitfalls.
Spread Your Knowledge. Questions with answers, tutorials and articles, newest first.
Go's net package offers TCP, UDP and Unix sockets with goroutines per connection. Learn deadlines, framing, graceful shutdown and common pitfalls.
Learn how Go's net, net/http and crypto/tls packages build TCP servers, HTTP APIs and clients, with deadlines, contexts and graceful shutdown.
Compare cgo, c-shared libraries, gRPC, subprocesses and WebAssembly for connecting Go with C, Python and other languages, with working examples.
Go has no built-in cross-process locks. See how to use sockets, pipes, gRPC, file locks and etcd or Redis locks for distributed and parallel Go systems.
Go runs goroutines in parallel on OS threads via its scheduler and uses os/exec for separate processes. See worker pools, locking and profiling techniques.
Use pprof, go test -bench and go tool trace to find CPU, memory and scheduling bottlenecks in Go programs, with runnable examples for each tool.
Go runs goroutines in parallel across CPU cores. Learn worker pools, chunking, atomics and profiling to speed up concurrent programs.
Learn Go concurrency patterns from the standard library: WaitGroup, channels, worker pools, context cancellation and safe shared state.
Goroutines cannot return errors directly. See how to use channels, errgroup, errors.Join and context to collect errors and cancel work safely.
Learn how the Go context package cancels goroutines, enforces timeouts and propagates deadlines, with runnable examples for HTTP handlers and workers.
Go reports some deadlocks at runtime and finds races with the -race flag. Learn the causes, fixes with mutexes, atomics and channels, and how to debug.
sync.Mutex prevents data races on shared state and sync.WaitGroup waits for goroutines to finish. See working examples, RWMutex, wg.Go and common mistakes.
Go synchronizes goroutines with channels, mutexes, WaitGroup and atomics. See when to use each, with runnable examples and race detector tips.
The Go select statement lets one goroutine wait on several channels at once. See how it handles timeouts, cancellation, default cases and common mistakes.
Goroutines are lightweight tasks scheduled by the Go runtime onto a few OS threads. See how they differ from threads and when each one matters.
Apply goroutines and channels to real problems: parallel work, pipelines, fan-out and fan-in, and error handling with errgroup. Includes common pitfalls.
Go concurrency is built on goroutines, channels, select, sync and context. See how each works, with runnable examples and common pitfalls.
Goroutines, channels, select, mutexes and context explained with runnable Go examples, plus common patterns and pitfalls such as leaks and data races.
Go has free community resources and paid commercial ones. See what each offers for learning, growing and contributing, and how to choose.
Learn where to study Go, ask questions, follow releases and contribute, from the Tour of Go and pkg.go.dev to forums, meetups and the Go issue tracker.