/TCP-UDP-socket-notes

Primary LanguageCGNU General Public License v3.0GPL-3.0

TCP&UDP Socket Programming Notes (Unfinished)

Preface

image
This repo contains codes and corresponding notes for network communication programs which were wrote during the undergraduate course Design of Network Software taught by Prof. Duan in 2020 spring semester (online) in UESTC. You can use these codes along with the readme.md in each section as a basic tutorial for knowing how to use TCP/UDP sockets and design the framework of different types of network communication software such as online chatting, file transferring, vedio stream transferring, etc. The only type of socket we discussed and showed in this repo is TCP/UDP socket (Layer 4). In each section's note, we will only discuss some valuable topics instead of all details, so in order to better understand all these codes and notes, it will be perfect that you had learn basic knowledge of the principle of computer network and TCP/IP stack before you check them. All the codes were wrote in C and are able to be compiled and run on both Windows & Linux environment.

Structure

This repo can be divided into three parts and they're arranged as below:

PART 1: Basic Notes of Socket

  • Section 1: Socket (Finished)
    • What is a socket?
    • What is the relationship among socket, socket address, port and ip address?
    • What are Host-byte order, Network-byte order, Big endian, Small endian and why?
    • How to create a socket under Windows and Linux?
    • How to bind a socket to a local socket address?
  • Section 2: C/S Model (Finished)
    • What is Client/Server Model and why?
    • What Connection-oriented and Connectionless-oriented refer to?
    • What is the difference between Stream Service and Datagram Service?
    • How to use basic socket-related interface functions?
    • Write connction-oriented and connectionless-oriented C/S programs for basic string transferring!
  • Section 3: Shutdown of Connection-oriented Service
    • "Rough Closure"
    • Closing by High level Consultation
    • "Elegant Closing"

PART 2: Framework of Network Communication Software

PART 3: Extension and Examples

Contribution