Fading Coder

One Final Commit for the Last Sprint

Building Static and Shared Libraries with GCC on Linux

Static libraries bundle multiple object files into a single archive, while shared libraries defer symbol resolution until load or runtime. Both forms are comon on Linux and can be produced with GCC and standard binutils. Inspecting a system static library Static archives are regullar files with the...

Building a C MQTT Client with libmosquitto: Publish/Subscribe Patterns and Topic Filtering

MQTT uses a broker-centric model: all data flows through a broker, while clients act as publishers, subscribers, or both. A single process can publish and subscribe at the same time without being a broker itself. A common pitfall is subscribing and publishing to the same topic from one client. Many...

Linux C/C++ Socket Programming by Example: TCP/UDP Chat, select, Threads, Timers, and fork

TCP Chat over a Local Network Minimal TCP Echo Server (C) #include <arpa/inet.h> #include <errno.h> #include <netinet/in.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/socket.h> #include <sys/types.h> #include <unistd.h&...

Implementing a Minimal Passive-Mode FTP Client in C

Implementing a client for the FTP control and data channels requires speaking a simple, line-oriented, text protocol over TCP. Commands are ASCII lines terminated by CRLF (\r\n). Replies are lines beginning with a three-digit code followed by text and CRLF. Only the numeric code is needed for flow c...

GCC dependency generation: -M, -MM, -MD, -MMD, -MF, -MT

These options drive how GCC emits Makefile-style dependency rules. They’re useful for incremental builds that only recompile what chenged. Example source Create a tiny program to reference in the examples: // deps.c #include <stdio.h> int main(void) { int value = 21 * 2; printf("%d\n"...

Building a Minimal Thread Pool in C with POSIX Threads

Thread pools are a common concurrency primitive for servers and systems programming. Instead of creating a thread for each task, a thread pool maintains a fixed set of worker threads that pull work items from a shared queue. This approach cuts thread creation/destruction overhead and keeps latency l...