Chia-Chih
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.

      Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Explore these features while you wait
      Complete general settings
      Bookmark and like published notes
      Write a few more notes
      Complete general settings
      Write a few more notes
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.

    Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Explore these features while you wait
    Complete general settings
    Bookmark and like published notes
    Write a few more notes
    Complete general settings
    Write a few more notes
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # CSE350期中筆記 ###### tags: `NSYSU` ## Chapter1 1. Packet switching vs Circuit switching 2. Internet Delay & packet lost 3. Protocal stack & OSI model 4. Encapsulation ## Chapter2 1. Client & Server + 伺服器端有固定的 IP 位址且永遠開啟並等候要求,通常單一伺服器無法容納所有用戶端的請求,所以一個資料中心 (Data Center) 有許多主機來建立一個虛擬伺服器。 2. P2P(Peer to Peer) architecture: + 利用一對對間歇性連線主機 (Peer) 之間進行的直接通訊。 + Peer 不屬於服務提供者,所以不會透過專門的伺服器進行通訊。 + Self-scalability: Peer 之間會透過散佈檔案傳給其他 Peer 而增加系統的服務容量。 + Advantage: 通常不需要大量的伺服器基礎設施和伺服器頻寬。 + Challenge: + 對 ISP 友善:P2P 會將視訊串流與檔案傳輸應用等上傳資料流從伺服器移向家用 ISP而帶給 ISP 壓力。 + 安全性:因高度分散與開放的本質。 + 誘因:仰賴使用者貢獻。 + 由於每個peer不一定會在線上,所以會有管理上的困難 3. Transport service requirements: Common apps(舉例) + data integrity + security + timing + throughput 4. TCP VS UDP (PPT 2-15) + TCP + Properties: + reliable data transfer + flow control + congestion control + connection-oriented + Defact: Don't provide + timing guarantee + minimum throughput guarantee + security + UDP + Property: + unreliable data transfer + Defact: Don't provide + reliability + flow control + congestion control + timing, throughput guarantee + security + connection setup 5. HTTP is "stateless" + server maintains no information about past client requests + state壞處:程式會變得很複雜 6. HTTP non-persistent figure & persistent + non-persistent HTTP + at most one object sent over TCP connection + connection then closed + downloading multiple objects required multiple connections + Round-Trip Time(RTT) def: time for a small packet to travel from client to server and back. + Response time(downloading an object) + one RTT to initiate TCP connection + one RTT for HTTP request and first few bytes of HTTP response to return + file transmission time + Total: 2RTT + file transmission time + Defact: + 2 RTT/object + OS overhead for each TCP connection + persistent HTTP + multiple objects can be sent over single TCP connection between client, server. + one RTT for all the referenced objects. 7. Proxy sever: soft state + Proxy server(web cache)會保存最近被請求過的物件副本, 如果使用者請求的物件沒有在proxy server裡的話,proxy server會向原本的server請求物件 + soft state: 保存最近被請求過的物件副本,過一段時間就要 重新跟原本server請求物件 8. Pull & Push + Pull: Client主動向Server發出request(如:HTTP) + Push: Server主動向Client傳輸資料(如:SMTP) 9. DNS records + RR format:(name, value, type, ttl) + type A + name = hostname + value = IP address + type NS + name = domain + value = hostname of authoritative name server for this domain. + type CNAME + name = alias name for some canonical(the real) name + value = canonical name + type MX + value = name of mailserver associated with name ## Chapter3 1. Multiplexing & Demultiplexing(PPT 3-11) + Multiplexing at sender + Handle data from multiple sockets, add transport header. + Demultiplexing at receiver + Use header info to deliver received segments to correct socket. + How works + Host receives IP datagrams and uses IP addresses & port numbers to direct segment to appropriate socket. ![](https://i.imgur.com/EwRvfCB.png) 2. Checksum: 1's complement + Treat segment contents, including header fields, as sequence of 16-bit integers. ![](https://i.imgur.com/f5xvSN9.png) 3. Reliable Data Transfer(RDT) ![](https://i.imgur.com/oiaQVXU.png) + RDT1.0: reliable transfer over a reliable channel + underlying channel perfectly reliable + no bit errors + no loss of packets ![](https://i.imgur.com/CVK33iT.png) + RDT2.0: channel with bit errors + underlying channel may flip bits in packet, but won't loss packets + checksum to detect bit errors + Recover from errors + ACKs + NAKs + New features + error detection + receiver feedback ![](https://i.imgur.com/am8G6Ph.png) + RDT2.1: + sender + sender retransmits current pkt if ACK/NAK corrupted + sender adds sequence number to each pkt ![](https://i.imgur.com/f1u7wOM.png) + receiver + receiver discards (doesn’t deliver up) duplicate pkt ![](https://i.imgur.com/EFp17nG.png) + RDT2.2: A NAK-free protocol + using ACKs only + receiver sends ACK for last pkt received OK + receiver must explicitly include seq # of pkt being ACKed + duplicate ACK at sender results in same action as NAK: retransmit current pkt + RDT3.0: + Reason + underlying channel can also lose packets. + Approach + sender waits reasonable amount of time of ACK + retransmits if no ACK received in this time + if packet (or ACK) just delayed: + retransmission will be duplicate, but seq #'s already handles this. + receiver must specify seq# of pkt being ACKed. + requires countdown timer + Sender ![](https://i.imgur.com/Oef9Oex.png) 4. (PPT 3-45) 為何$U_{sender} = \frac{3L/R}{RTT + L/R}$中$RTT$不用乘3 ![](https://i.imgur.com/AgwtR8Q.png) ANS: $lim_{n\to\infty} \frac{n(3L/R)}{n(RTT+L/R)+2L/R} = \frac{3L/R}{RTT+L/R}$ 5. Go-Back-N + sender + ACK(n):ACKs all pkts up to, including seq#n -> cumulative ACK + may receive duplicate ACKs(see receiver) + timer for oldest in-flight pkt + timeout(n): retransmit packet n and all higher seq# pkts in window ![](https://i.imgur.com/iRTuOwJ.png) + receiver + always send ACK for correctly-received pkt with highest in-order seq# + may generate duplicate ACKs + need only remember expectedseqnum + out-of-order pkt + discard(don't buffer) + re-ACK pkt with highest in-order seq# ![](https://i.imgur.com/Scu14BD.png) 6. (PPT 3-52 下圖有錯) ![](https://i.imgur.com/9VarLQZ.png) 圖中紅框部分: 上圖尚未送出封包下圖卻已經ACK 7. selective repeat sender & receiver + sender + case1: 收到上層的資料 + 當收到上層的資料,sender檢查下一個可以傳的封包序號, 如果序號在窗格裡則把資料封裝成封包並送出。 + 如果序號沒有在窗格裡則存入緩衝區或者退回上層,稍後再傳。 + case2: Timeout + 每個傳出去的封包都會有一個計時器 + 如果該封包的計時器超過一定時間,則重傳該封包並重新開始 計時器 + case3: 收到ACK(n) + 收到序號n的ACK則把序號n的封包標記為已收到 + 如果序號n在窗格內且序號等於send_base則將 send_base設為序號最小的未確認封包上。 + receiver + case1: 接收到的封包序號位於\[rcv_base, rcv_base+N-1\] + 回傳該封包的ACK給sender + 若該封包之前沒收到過則存入緩衝區 + 若該封包的序號等於rcv_base,則之前存入緩衝區的封包 都往上層傳(與rcv_base連續的封包) + case2: 接收到的封包序號位於\[rcv_base-N, rcv_base-1\] + 回傳該封包的ACK給sender且不存入緩衝區 + Default: 不做任何事 8. TCP sender & receiver + sender + events + data rcvd from app + create segment with seq# + seq# is byte-stream number of first data byte in segment + start timer if not already running + timeout + retransmit segment that caused timeout + restart timer + ack rcvd + if ack acknowledges previously unacked segments + update what is known to be ACKed + start timer if there are still unacked segments 9. TCP Ack generation | event | TCP receiver action| | -------- | -------- | | 按預期seq編號到達,所有預期編號之前的區段皆已ACK | 等待下一區段到達再ACK,至多等待500ms | | 按預期seq編號到達,有區段尚未ACK | 立刻送出一筆ACK,一次確認兩筆區段 | | 比預期seq編號大的區段到達,出現Gap | 立刻送出duplicate ACK,指出預期seq編號 | | 抵達區段可填補Gap | 立刻送出ACK,指出Gap底部 | 10. TCP fast retransmit:網路不算差時可以快速重傳 + 逾時重送的機制,等待timeout會拖延重送遺失封包 + 利用"Duplicate ACK"來偵測封包的遺失 + sender通常一次送出大量區段,當區段遺失時便會收到許多相同的duplicate ACK + 當sender收到3個以上相同data的ACK,就會認為區段已遺失,不需等待timeout即重送 11. TCP 3-way handshake ![](https://i.imgur.com/Qg6450R.png) 12. TCP slow-start 變化圖 ![](https://i.imgur.com/rAq6qdp.png) 13. TCP Congestion control FSM diagram ![](https://i.imgur.com/rBGbGGv.png) 14. TCP 不公平的原因 + 假設只有TCP連線會通過瓶頸連結且所有連線都有相同的RTT + 每對主機與目的端之間都只存在單筆TCP連線 + RTT較短會有更高的產出率 15. TCP close connection ![](https://i.imgur.com/ze2wtYp.png)

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password
    or
    Sign in via Google Sign in via Facebook Sign in via X(Twitter) Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    By signing in, you agree to our terms of service.

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully