Accompanying slides for Project 4

Download Report

Transcript Accompanying slides for Project 4

CS415
Minithreads Project 4
Overview
Adrian Bozdog (Adi)
[email protected]
What you have to do
 Implement connection-based reliable
communication
IP-like/UDP-like/TCP-like protocol
Based on the previous implementation
Correct implementation
Window size may be one (one packet in
transit)
 An application message can have any size
(not limited by max network datagram size)




CS414 Minithreads overview
2
Reliable communication
 Set up a connection
 Packets sent from specific local ports
belong to the connection
 Use the connection to send/receive the
messages
 Do not use miniport structures
 Use minisocket structures
 Close the connection
CS414 Minithreads overview
3
TCP-like protocol
 Every packet must be acknowledged by the
receiver
 Ordered packet delivery
 The sender resends a packet :
 After a specific timeout
 If it does not receive an ack
 Implements a handshaking protocol to open a
connection:
 The client sends an open connection packet to the
server
 The server sends an open connection ACK to the
client
 The client sends back an ACK to the server
CS414 Minithreads overview
4
TCP implementation
details
 You should cope with packet duplicates
 Receiver must:
 Keep track of received packets
 Suppress duplicates of received packets
 Sender must:
 Suppress duplicates of received ACKs
 Specific scheme for retransmissions and
timeouts (see project description)
 Sender stops sending a packet after 12.7
seconds (after 7 retransmissions)
CS414 Minithreads overview
5
Stream-oriented protocol
 A sender may send a message of any size
 The sender side fragments large messages
into several packets:
 Packet size =< MAX_NETWORK_PKT_SIZE
 Do not preserve message boundaries at
the receiver:
 Receiver side is not required to wait for all
pieces of the message
 See project description
CS414 Minithreads overview
6
Implementation hints
 Modular-like implementation:
 Do not mix the code for TCP-like protocol and the
code for UDP-like protocol in the same function
 Protocols should communicate only using API
defined in header files
 TCP-like protocol will use UDP-like protocol
functionalities (send and receive functions)
 Any protocol may add its header to a message
(minimsg and minisocket headers)
User application
TCP-like protocol
UDP-like protocol
Network
CS414 Minithreads overview
7
Implementation hints (2)
 UDP protocol (minimsg.c) must distinguish the type
of communication
 Uses an extra field (type) in its header
 Define a function in minimsg that will be used to send
packets for all types of communication (do not change API
provided – e.g minimsg_send declaration)
 Minimsg_send will use the new defined function to send a
packet
 A control packet used by the TCP-protocol is not
received by the application
 Minithread system:
 uses a function provided by the TCP-protocol to process the
control packet
 Does not store the control packet to a port
 Read hints from the project description
CS414 Minithreads overview
8
Compilation hints
 Minimsg.h is modified a little bit to avoid
circular including (use it to compile the code
properly)
 Compile the code for Jornada:
 Set the two environment variables on the desktop
that compile Jornada code (set it once for the
entire semester)
 Read tips for compiling and running programs on
Jornada (see web site)
CS414 Minithreads overview
9
CS414 Minithreads overview
10