Skip to content

Latest commit

Β 

History

History
144 lines (102 loc) Β· 3.6 KB

File metadata and controls

144 lines (102 loc) Β· 3.6 KB

πŸ§ͺ EE323 Network Programming Assignments

This repository contains solutions to four major network programming assignments from KAIST's EE323 Computer Networks course. The assignments progressively build an understanding of socket programming, application-layer protocols, network-layer routing, and transport-layer reliability.

πŸ—‚ Assignments Overview

πŸ“‘ Assignment 1: TCP Echo Server and Client

Goal: Implement a simple server that accepts TCP connections and echoes client messages line by line.

  • βœ… Each client runs in its own process (via fork()).
  • βœ… Message is transmitted upon pressing Enter.
  • βœ… Double Enter triggers client exit.
  • βœ… Command-line interface using getopt() (-p, -h).
  • βœ… Compatible with file redirection and piping (< input.txt, > output.txt).

Files:

  • server.c
  • client.c
  • Makefile

Run:

# Server
$ ./server -p 12345

# Client
$ ./client -p 12345 -h 127.0.0.1

🌐 Assignment 2: HTTP Proxy Server

Goal: Build a multi-client HTTP/1.0 proxy server supporting basic caching and blacklisting.

  • βœ… Accepts requests, forwards them to destination servers, returns responses.
  • βœ… Parses HTTP requests (method, URL, host).
  • βœ… Filters blacklisted domains and redirects to http://warning.or.kr.
  • βœ… Can be tested with browser, telnet, or Python script.
  • βœ… Properly handles malformed requests with HTTP 400.

Files:

  • proxy.c
  • Makefile

Run:

$ ./proxy <PORT> < blacklist.txt

Test (example):

$ telnet localhost <PORT>
GET http://example.com/ HTTP/1.0
Host: example.com

🚦 Assignment 3: Software Router Implementation (via Mininet + POX)

Goal: Simulate a software router that performs routing, ARP handling, ICMP response, and packet forwarding in a Mininet-emulated network.

  • βœ… Responds to ARP requests and maintains ARP cache.
  • βœ… Responds to ICMP Echo Requests and Time Exceeded (Traceroute).
  • βœ… Filters packets from blacklisted subnets (10.0.2.0/24).
  • βœ… Drops packets with unresolved ARP after timeout, replies with ICMP Unreachable.
  • βœ… Fully tested using Mininet and POX SDN controller.

Files:

  • router/sr_router.c
  • router/sr_arpcache.c
  • router/Makefile

Run (inside VM):

$ ./run_pox.sh
$ ./run_mininet.sh
$ ./sr

πŸ“¦ Assignment 4: Reliable Transport Layer (STCP)

Goal: Implement a simplified TCP-like transport protocol called STCP.

  • βœ… Three-way handshake (SYN/SYN-ACK/ACK)
  • βœ… Four-way connection teardown (FIN/ACK)
  • βœ… In-order, reliable, full-duplex transmission
  • βœ… Sliding window with slow start
  • βœ… Logging transmission statistics (client_log.txt, server_log.txt)
  • βœ… Compatible with mysock interface (provided stub)

Files:

  • transport.c (ONLY file modified)
  • Compiles with provided Makefile

Run:

# Server
$ ./server

# Client
$ ./client <SERVER_IP>:<PORT> -f testfile.txt

Output:

  • File rcvd is saved at the client side.
  • Logs are saved in the root directory.

πŸ›  Build Instructions

Each assignment contains a Makefile. Run:

$ make

To clean:

$ make clean

⚠ All code is tested and compiled on KAIST lab machines (eelab5, eelab6). Behavior may vary on other environments.


πŸ“š References

  • Beej’s Guide to Network Programming
  • RFC 793 – Transmission Control Protocol
  • RFC 1945 – HTTP/1.0 Specification
  • Mininet & POX documentation

🚫 Academic Integrity

Do not reuse or redistribute this repository for academic credit. This work is intended for educational reference and self-study only.