tags : Network Programming, Networking, NAT

TODO FAQ

IP and TCP/UDP

  • IP
    • Naming scheme
    • host-to-host
  • UDP
    • process-to-process
  • TCP
    • process-to-process over connections using byte streams

TODO Stream vs Packet

  • TCP/IP is stream-oriented
    • Segment??
  • UDP is packet-oriented

TODO Segment vs Packets vs Frames

TODO Missing Segments in TCP

  • Single segment: (Eg. no more data to send), and that packet s lost, the sender will eventually time out and resend the segment. There’s no way for the receiver to know that there was a segment in flight, so it can’t tell you that it didn’t get it.
  • Multiple segments
    • One in the middle has been lost
    • Receiver will send out an ACK for every new segment
      • ACK: highest octet of the segment that arrived in sequence
      • Eg. Sender transmits 1460 octet segments with initial seq no. of 1, 1461, 2921, 4380, and 5840, and the 2921 segment gets lost, it send back ACK of (2920, 2920, 2920, 2920).
      • First segment skipped because of delatyed ACK (???)
  • So it’ll detect duplicate ACKs and retransmit missing segments. Selective ACK(SACK) can also help here.

TODO TCP Handshake?

TODO UDP is connectionless, but UDP has connection tuple?

TCP

  • Connection: 4-tuple{s_ip, s_port, d_ip, d_port}

Handshake

Resources

UDP

  • Connected sockets: 4-tuple{s_ip, s_port, d_ip, d_port}
    • Mostly used for outgoing flows
  • Unconnected sockets: 2-tuple{bind_ip, bind_port}
    • Mostly used for inbound server-side stuff

Resources