<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Networking on Zitao Liao</title><link>http://lzteddy.com/tags/networking/</link><description>Recent content in Networking on Zitao Liao</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><lastBuildDate>Tue, 19 May 2026 00:00:00 +0000</lastBuildDate><atom:link href="http://lzteddy.com/tags/networking/index.xml" rel="self" type="application/rss+xml"/><item><title>Projects</title><link>http://lzteddy.com/p/projects/</link><pubDate>Sat, 18 Apr 2026 00:00:00 +0000</pubDate><guid>http://lzteddy.com/p/projects/</guid><description>&lt;p&gt;This page is now an index. Each project has been split into an independent post:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;【Generative AI】&lt;a class="link" href="http://lzteddy.com/p/weibo-personality-analyzer/" &gt;Weibo Personality Analyzer&lt;/a&gt;&lt;br&gt;
GitHub: Public repository link not provided&lt;/li&gt;
&lt;li&gt;【Operating System】&lt;a class="link" href="http://lzteddy.com/p/procfs-filesystem-rust-asterinas/" &gt;ProcFS Filesystem Based on Rust &amp;amp; Asterinas&lt;/a&gt;&lt;br&gt;
GitHub: &lt;a class="link" href="https://github.com/Tsurumalu/OS-ProcFS-Project" target="_blank" rel="noopener"
 &gt;Tsurumalu/OS-ProcFS-Project&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;【Deep Learning】&lt;a class="link" href="http://lzteddy.com/p/intelligent-sanitation-robot/" &gt;Intelligent Sanitation Robot with Deep Learning&lt;/a&gt;&lt;br&gt;
GitHub: &lt;a class="link" href="https://github.com/EpsilonZYJ/NUS-SOC" target="_blank" rel="noopener"
 &gt;EpsilonZYJ/NUS-SOC&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;【Deep Learning】&lt;a class="link" href="http://lzteddy.com/p/jetson-nano-facial-emotion-analysis/" &gt;Real-time Facial Emotion Analysis on Jetson Nano&lt;/a&gt;&lt;br&gt;
GitHub: &lt;a class="link" href="https://github.com/Q-Daisy/Ultra-Light-Fast-Generic-Face-Detector-1MB" target="_blank" rel="noopener"
 &gt;Q-Daisy/Ultra-Light-Fast-Generic-Face-Detector-1MB&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;【MCM】&lt;a class="link" href="http://lzteddy.com/p/mcm-voting-mechanism-optimization/" &gt;Modeling and Optimization of Voting Mechanisms&lt;/a&gt;&lt;br&gt;
GitHub: Public repository link not provided&lt;/li&gt;
&lt;li&gt;【Computer Organization】&lt;a class="link" href="http://lzteddy.com/p/riscv-pipelined-cpu-verilog/" &gt;Pipelined RISC-V CPU Design in Verilog&lt;/a&gt;&lt;br&gt;
GitHub: &lt;a class="link" href="https://github.com/Diaosi1317092/Computer-Organization-Project" target="_blank" rel="noopener"
 &gt;Diaosi1317092/Computer-Organization-Project&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;【Database】&lt;a class="link" href="http://lzteddy.com/p/opengauss-vs-postgresql-benchmark/" &gt;openGauss vs. PostgreSQL Performance Benchmark&lt;/a&gt;&lt;br&gt;
GitHub: &lt;a class="link" href="https://github.com/Tsurumalu/DB-Project3" target="_blank" rel="noopener"
 &gt;Tsurumalu/DB-Project3&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;【Java Programming】&lt;a class="link" href="http://lzteddy.com/p/java-swing-match3-game/" &gt;Java Swing Match-3 Puzzle Game&lt;/a&gt;&lt;br&gt;
GitHub: &lt;a class="link" href="https://github.com/Tsurumalu/3-Match-Java" target="_blank" rel="noopener"
 &gt;Tsurumalu/3-Match-Java&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;【Digital Logic】&lt;a class="link" href="http://lzteddy.com/p/range-hood-fpga-verilog/" &gt;Range Hood FPGA Control System in Verilog&lt;/a&gt;&lt;br&gt;
GitHub: &lt;a class="link" href="https://github.com/Diaosi1317092/Digital-Logic-Project" target="_blank" rel="noopener"
 &gt;Diaosi1317092/Digital-Logic-Project&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;【Machine Learning】&lt;a class="link" href="http://lzteddy.com/p/loan-default-prediction-ml/" &gt;Loan Default Prediction with Machine Learning&lt;/a&gt;&lt;br&gt;
GitHub: Public repository link not provided&lt;/li&gt;
&lt;li&gt;【Computer Network】&lt;a class="link" href="http://lzteddy.com/p/cs305-p2p-file-transfer/" &gt;P2P Reliable File Transfer with Congestion Control&lt;/a&gt;&lt;br&gt;
GitHub: &lt;a class="link" href="https://github.com/Tsurumalu/Computer-Network-Project-P2P" target="_blank" rel="noopener"
 &gt;Tsurumalu/Computer-Network-Project-P2P&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;【Distributed System】&lt;a class="link" href="http://lzteddy.com/p/sustech-merch-store/" &gt;SUSTech Merch Store Microservices&lt;/a&gt;&lt;br&gt;
GitHub: &lt;a class="link" href="https://github.com/Tsurumalu/SUSTech-Merch-Store" target="_blank" rel="noopener"
 &gt;Tsurumalu/SUSTech-Merch-Store&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;</description></item><item><title>P2P Reliable File Transfer with Congestion Control</title><link>http://lzteddy.com/p/cs305-p2p-file-transfer/</link><pubDate>Fri, 19 Dec 2025 00:00:00 +0000</pubDate><guid>http://lzteddy.com/p/cs305-p2p-file-transfer/</guid><description>&lt;h2 id="background"&gt;Background
&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;Time: Dec 2025&lt;/li&gt;
&lt;li&gt;Context: Group course project for SUSTech CS305 (Computer Networks).&lt;/li&gt;
&lt;li&gt;Repository: &lt;a class="link" href="https://github.com/Tsurumalu/Computer-Network-Project-P2P" target="_blank" rel="noopener"
 &gt;Tsurumalu/Computer-Network-Project-P2P&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="goal"&gt;Goal
&lt;/h2&gt;&lt;p&gt;Build a &lt;strong&gt;reliable peer-to-peer (P2P) file transfer application&lt;/strong&gt; on top of &lt;strong&gt;UDP&lt;/strong&gt;. All transport semantics—handshaking, reliable delivery, retransmission, and congestion control—are implemented at the application layer. The system uses a network simulator for testing under packet loss, varying topologies, and peer crashes.&lt;/p&gt;
&lt;h2 id="system-overview"&gt;System Overview
&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;File &amp;amp; chunk model:&lt;/strong&gt; Files are split into 512 KiB chunks; each chunk is identified by a SHA-1 hash (20 bytes).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Peer model:&lt;/strong&gt; Each peer holds a fragment (subset) of chunks and can upload to or download from other peers concurrently.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Download flow:&lt;/strong&gt; On a &lt;code&gt;DOWNLOAD&lt;/code&gt; command, a peer discovers missing chunks via &lt;code&gt;WHOHAS&lt;/code&gt; / &lt;code&gt;IHAVE&lt;/code&gt;, requests them with &lt;code&gt;GET&lt;/code&gt;, then reassembles completed chunks into a pickle-serialized fragment file.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Concurrency:&lt;/strong&gt; Single-threaded event loop using &lt;code&gt;select&lt;/code&gt;; multiple chunk downloads from different peers run in parallel, with per-session upload limits enforced via &lt;code&gt;DENIED&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="packet-protocol"&gt;Packet Protocol
&lt;/h2&gt;&lt;p&gt;Custom UDP packets (max 1400 bytes) with header fields for type, length, and sequence/ACK number:&lt;/p&gt;
&lt;table&gt;
 &lt;thead&gt;
 &lt;tr&gt;
 &lt;th&gt;Type&lt;/th&gt;
 &lt;th&gt;Code&lt;/th&gt;
 &lt;th&gt;Role&lt;/th&gt;
 &lt;/tr&gt;
 &lt;/thead&gt;
 &lt;tbody&gt;
 &lt;tr&gt;
 &lt;td&gt;WHOHAS&lt;/td&gt;
 &lt;td&gt;0&lt;/td&gt;
 &lt;td&gt;Query which peers hold requested chunks&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;IHAVE&lt;/td&gt;
 &lt;td&gt;1&lt;/td&gt;
 &lt;td&gt;Reply listing available chunks&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;GET&lt;/td&gt;
 &lt;td&gt;2&lt;/td&gt;
 &lt;td&gt;Request a specific chunk&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;DATA&lt;/td&gt;
 &lt;td&gt;3&lt;/td&gt;
 &lt;td&gt;Transfer chunk payload segments&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;ACK&lt;/td&gt;
 &lt;td&gt;4&lt;/td&gt;
 &lt;td&gt;Acknowledge received segments&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;DENIED&lt;/td&gt;
 &lt;td&gt;5&lt;/td&gt;
 &lt;td&gt;Reject when upload connection limit is reached&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 id="implementation-highlights"&gt;Implementation Highlights
&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Reliable data transfer (RDT):&lt;/strong&gt; Per-packet sequence numbers and ACKs; dynamic timeout from RTT estimation (α = 0.15, β = 0.3); timeout-based and fast retransmit (3 duplicate ACKs).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Congestion control (Tahoe-style):&lt;/strong&gt; Slow start and congestion avoidance with &lt;code&gt;cwnd&lt;/code&gt; and &lt;code&gt;ssthresh&lt;/code&gt;; loss triggers window halving and return to slow start. &lt;code&gt;cwnd&lt;/code&gt; history is recorded and plotted with matplotlib for presentation.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Structured codebase:&lt;/strong&gt; Refactored &lt;code&gt;peer.py&lt;/code&gt; with &lt;code&gt;PeerState&lt;/code&gt;, &lt;code&gt;DownloadSession&lt;/code&gt;, &lt;code&gt;UploadSession&lt;/code&gt;, and a &lt;code&gt;Peer&lt;/code&gt; class driving a non-blocking I/O loop.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Robustness:&lt;/strong&gt; Handles concurrent multi-peer downloads, connection limits, peer crashes, and out-of-order segment buffering.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Testing:&lt;/strong&gt; Validated with course-provided pytest suites (handshaking, basic transfer, concurrency, crash scenarios, and advanced topology tests) via &lt;code&gt;grader.py&lt;/code&gt; and the network simulator.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="tech-stack"&gt;Tech Stack
&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;Python 3.12&lt;/li&gt;
&lt;li&gt;UDP (&lt;code&gt;socket&lt;/code&gt;) with &lt;code&gt;select&lt;/code&gt; for single-threaded concurrency&lt;/li&gt;
&lt;li&gt;SHA-1 chunk hashing&lt;/li&gt;
&lt;li&gt;matplotlib (congestion window visualization)&lt;/li&gt;
&lt;li&gt;pytest &amp;amp; network simulator (grading and integration tests)&lt;/li&gt;
&lt;li&gt;Linux / WSL (required runtime environment)&lt;/li&gt;
&lt;/ul&gt;</description></item></channel></rss>