feat(lab7): implement iterative TCP server/client with dual-protocol parsing and tmux automation#9
Conversation
…or client and server for testing it
…t lacks safe exit
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.
Description
This Pull Request introduces the complete implementation of Lab 7: Socket-based Inter-Process Communication. It delivers a robust, production-ready iterative TCP/IPv4 server capable of dual-protocol parsing (HTTP/1.1 and custom text commands), a dedicated network client utility, and a fully automated
tmuxintegration testing harness.The entire codebase is strictly compliant with the ISO C11 standard and enforces rigorous error policing (
-Werror).Technical Implementation Highlights
9000across all interfaces (INADDR_ANY). It dynamically differentiates between incoming HTTPGET/POSTsequences (incrementing the session counter by 1 and responding with compliant HTTP/1.1 plain-text payloads) and customZADANIE <value>datagram streams (incrementing the counter by the arbitrary integer and returning raw payload text).sigaction()interface to interceptSIGINT(Ctrl+C). It safely flips avolatile sig_atomic_tflag, enabling blocking system calls likeaccept4()to fail naturally withEINTR, breaking the main event loop, and executing clean descriptor deallocation.accept4()system call decorated with theSOCK_CLOEXECflag to prevent descriptor pollution across process boundaries.MSG_NOSIGNALflag during standardsend()routines to prevent the kernel from delivering a fatalSIGPIPEsignal to the process if a client unexpectedly drops the connection.htons()andhtonl()macro wrappers.Directory Topology Added
Verification & Testing Performed
1. Automated Integration Test Suite
Validated end-to-end communication via the custom
scripts/test_automation.shharness. The execution sequence spawns a standalonetmuxsession, synchronizes local execution directories, runs sequential programmatic client queries, captures state tracking output, and triggers a clean shutdown.2. Manual Diagnostics
HTTP GET /).netcat:echo -n "ZADANIE 42" | nc 127.0.0.1 9000.ss -tulpn.3. Memory Profiling (Valgrind Audit)
Analyzed the executable layer via
Valgrind Memcheckto verify strict memory management and prevent kernel object leaks.Result:
All heap blocks were freed -- no leaks are possible.