Title: CSEE 145A Reliable Transmission over Unreliable Channel
1CS/EE 145AReliable Transmission over Unreliable
Channel
- Netlab.caltech.edu/course
2Lab 1
- QA
- What happens if the udp client cannot receive my
message? - Shall I receive and print the message on the
client side? - I did some extra work
- How do you grade my work?
3Lab 1
4Lab 1
5Lab 1
- Server (Advanced Function 1, Multi-connection)
6Lab 1
- Server (Advanced Function 2, 3-connections)
7Lab 1 Multiplexing
- Multiple Processes
- One process for each active TCP connection, one
UDP process and one Listening process - How to tell the main process when the child
processes finish the TCP connection? - SIGCHILD (with a handler in the main function)
8Lab 1 Multiplexing
- Multiple Threads
- Similar to Multiple Processes
- pthread_create
9Lab 1 Multiplexing
- Single Process
- Check status of all ports with a single select
function - Timeout of the select?
10Topics of this thread
- How does TCP/IP work? (roughly)
- Design and implementation of protocols
Lab 1
Lab 2, 3, 4
11Reliable Transmission over Unreliable Channel (I)
12Reliable Transmission over Unreliable Channel (I)
Stream
Stream
13Reliable Transmission over Unreliable Channel (I)
Stream
Stream
P1, P2,
???
14Reliable Transmission over Unreliable Channel
Goals
- We want the file to be transmitted without any
error. - We cannot make any assumption on the channel (The
packet may be dropped, re-ordered, duplicated in
the middle). - We dont want to waste time.
- We dont want to waste bandwidth.
15Reliable Transmission over Unreliable Channel
Difficulties
- How to split a file into packets?
- How to detect errors (packet corruption, packet
loss, duplication, reordering)? - How to recover from packets reordering?
- How to recover from loss?
- How to use the bandwidth efficiently?
- How to share the bandwidth fairly?
16Lab 2
- How to split a file into packets?
- How to detect errors (packet corruption, packet
loss, duplication, reordering)? - How to recover from packets reordering?
- How to recover from loss?
- How to use the bandwidth efficiently?
- How to share the bandwidth fairly?
17Lab 3
- How to split a file into packets?
- How to detect errors (packet corruption, packet
loss, duplication, reordering)? - How to recover from packets reordering?
- How to recover from loss?
- How to use the bandwidth efficiently?
- How to share the bandwidth fairly?
18Lab 4
- How to split a file into packets?
- How to detect errors (packet corruption, packet
loss, duplication, reordering)? - How to recover from packets reordering?
- How to recover from loss?
- How to use the bandwidth efficiently?
- How to share the bandwidth fairly?
19Split a file
Sender
Whats inside a packet?
File
File
Receiver
20Inside a packet
- Data
- Header
- Help to reassembly
- Help to detect errors
21(No Transcript)
22One Example TCP Header
Packet Identification
Detect Packet Corruption
- Source http//linux-ip.net/gl/tcng/node39.html
23Sequence Number (Packet ID)
Sender
File
1
2
3
4
5
6
7
8
1
2
3
4
5
6
7
8
File
Receiver
24In case of packet loss
Sender
Why?
File
1
2
3
4
5
6
7
8
1
2
4
5
6
7
8
Please Retransmit packet 3
Receiver
25In case of packets reordering
Sender
Why?
File
1
2
3
4
5
6
7
8
1
2
3
4
5
6
7
8
1
2
3
4
5
6
7
8
Receiver
26Packet duplication
Sender
Why?
File
1
2
3
4
5
6
7
8
8
1
3
4
2
5
6
7
2
1
2
3
4
6
7
8
5
Receiver
27Sequence Number (Packet ID)
- With the packet ID, the receiver side can recover
from packet reordering and packet duplication. - The receiver can detect packet loss. But it has
to call sender for retransmission.
28CS/EE 145A Lab 2Packet
- Netlab.caltech.edu/course
29Tasks for Lab 2( Not a network programming! ? )
- Assume there is no packet corruption
- Design a packet format that can be used to
transmit data reliably, over unreliable channels - Implement conversion from a file to packets, at
sender side. - Implement error detection and file reassembly, at
receiver side.
30Sequence Number (Packet ID)
Sender
File
1
2
3
4
5
6
7
8
1
2
3
4
5
6
7
8
File
Receiver
31Sender
- sender ltfilenamegt ltPacketSizegt
- Read the file specified by ltfilenamegt (The file
contains English characters and numbers only) - Convert this file into packets, each packet has
at most ltPacketSizegt bytes, including header. - Save each packet to one file, with a file name as
P0000001.txt, P0000002.txt,
32Receiver
- receiver ltnumber of packetsgt ltPacketSizegt
ltfilenamegt - Read the files for packets ( P0000001.txt,
P0000002.txt) - WARNING The filenames are always from 1 to
ltnumber of packetsgt. But packets may not have the
same filenames assigned by the sender, due to
packet loss, packet reordering or packet
duplication. - Convert the packets into a file, specified by
ltfilenamegt. Use one character to indicate
each lost packet.
33Example
- File abcdefg
- Packet Size10 bytes
- Header size 7 bytes
- Payload 3 bytes
- Sender Output 3 files
- P0000001.txt ltheadergt abc
- P0000002.txt ltheadergt def
- P0000003.txt ltheadergt g
34Example
- After reordering (by a program written by TA)
- P0000001.txt ltheadergt abc
- P0000002.txt ltheadergt g
- P0000003.txt ltheadergt def
- Receiver
- Output a file abcdefg
35Example
- After packet loss (by a program written by TA)
- P0000001.txt ltheadergt g
- P0000002.txt ltheadergt def
- Receiver
- Output a file defg
36Tips
- For the unknown commands, use man/ info.
- Be careful of the data structures
- Testing design some small examples to test your
program - Start Earlier!
37Submission (due Nov 7th 235959)
- Task sender.c receiver.c readme.txt
- Mailto weixl_at_cs.caltech.edu
- Documents
- How to use the programs compile, run
- Design, testing cases, the problems you met
- Any other comments
38Grading
- Correctness (70)
- Documentation and comments (20)
- Program style (10)
TA Hours
- Tue 2000 2200 JRG 170
- Thu 2000 2200 JRG 170