Simulation of Datalink Layer Communication Speaker: Jae Chung

Slides:



Advertisements
Similar presentations
Introduction 1 Lecture 13 Transport Layer (Transmission Control Protocol) slides are modified from J. Kurose & K. Ross University of Nevada – Reno Computer.
Advertisements

TFTP (Trivial File Transfer Protocol)
Data Communications and Computer Networks Chapter 3 CS 3830 Lecture 16 Omar Meqdadi Department of Computer Science and Software Engineering University.
I/O Multiplexing Road Map: 1. Motivation 2. Description of I/O multiplexing 3. Scenarios to use I/O multiplexing 4. I/O Models  Blocking I/O  Non-blocking.
Today’s topic Issues about sending structures with TCP. Server design alternatives: concurrent server and multiplexed server. I/O multiplexing.
Global Employee Location Server Jeff Zhou 3/19/2011 CS4516 HELP Session 1 Modified based on CS4514 B05 slides.
Computer Networks Sockets. Sockets and the OS F An end-point for Internet connection –What the application “plugs into” –OS provides Application Programming.
Client 1 Client 2 Server Child Process1 Child Process2 (1) (2) (3) serverbase.txt Note: each child process keeps a separate copy of the DB.
Client 1 Client 2 Server Child Process1 Child Process2 (1) (2) (3) serverbase.txt Note: each child process keeps a separate copy of the DB.
CS4514-Help Session By Huahui Wu. Description In this project, you are supposed to implement a PAR (Positive Acknowledgement with Retransmission)
CS4514 HELP Session 3 Concurrent Server Using Go-Back-N Song Wang 12/08/2003.
Concurrent Server Using Selective Repeat Data Link Layer Mingzhe Li 12/05/2005 CS4514 HELP Session 3.
CS4514 Assignment 2 Help Session – Data Link Layer Client and Server Processes Speaker: Hao Shang Date: Nov. 11th, 2004.
CS4514 HELP Session 3 Concurrent Server Using Go-Back-N Song Wang 02/17/2004.
1 CS4514 – B03 Project 2 Help Session Choong-Soo Lee November 24, 2003.
Network LayerDatalink LayerPhysical LayerNetwork LayerDatalink LayerPhysical Layer ClientServer Framework.
WXES2106 Network Technology Semester /2005 Chapter 8 Intermediate TCP CCNA2: Module 10.
Lecture 8 UDP Sockets & I/O Multiplexing
3-1 Transport services and protocols r provide logical communication between app processes running on different hosts r transport protocols run in end.
1 CS4514 Project 2 Help Session (B05) Mingzhe Li Nov 10, 2005.
IP Multiplexing Ying Zhang EECS 489 W07.
Project 2: A P2P Chat Application Review Ananth Rao.
CS4516: Medical Examiner Client/Server Evan Frenn 1.
CS 4396 Computer Networks Lab
CS/EE 145A Reliable Transmission over Unreliable Channel Netlab.caltech.edu/course.
1 CS3516 Project 3 Help Session (B14) Dongqing Xiao Dec 04, 2014.
Review: How to create a TCP end point? What is the right format for sin_port and sin_addr in the sockaddr_in data structure? How many different ways we.
Review:. Chapter 3: The Data Link Layer –achieve reliable, efficient communication between two physically connected machines. –Example problems to be.
TELE 402 Lecture 4: I/O multi … 1 Overview Last Lecture –TCP socket and Client-Server example –Source: Chapters 4&5 of Stevens’ book This Lecture –I/O.
CS 453 Computer Networks Lecture 9 Layer 2 – Data Link Layer.
Socket Programming Lec 2 Rishi Kant. Review of Socket programming Decide which type of socket – stream or datagram. Based on type create socket using.
1 I/O Multiplexing We often need to be able to monitor multiple descriptors:We often need to be able to monitor multiple descriptors: –a generic TCP client.
CSCE 515: Computer Network Programming Select Wenyuan Xu Department of Computer Science and Engineering.
Networking Tutorial Special Interest Group for Software Engineering Luke Rajlich.
Forward Error Correction vs. Active Retransmit Requests in Wireless Networks Robbert Haarman.
I/O Multiplexing. What is I/O multiplexing? When an application needs to handle multiple I/O descriptors at the same time –E.g. file and socket descriptors,
CSE 123 Discussion 10/05/2015 Updated from Anup and Narendran’s excellent notes.
1 CS 4396 Computer Networks Lab TCP – Part II. 2 Flow Control Congestion Control Retransmission Timeout TCP:
Today’s topic: UDP Reliable communication over UDP.
Transport Layer 3-1 Internet Transport Layer Lecture 8 Dr. Najla Al-Nabhan.
CMPT 471 Networking II Network Programming © Janice Regan,
Socket Programming. Computer Science, FSU2 Interprocess Communication Within a single system – Pipes, FIFOs – Message Queues – Semaphores, Shared Memory.
1 CS3516 Project 3 Help Session (A15) Dongqing Xiao Sep 30th,2015.
Data Link Layer. Data link layer The communication between two machines that can directly communicate with each other. Basic property – If bit A is sent.
CS 145A Reliable Communication Netlab.caltech.edu/course.
Chapter 3: The Data Link Layer –to achieve reliable, efficient communication between two physically connected machines. –Design issues: services interface.
Chapter 9: Transport Layer
Chapter 3 Transport Layer
I/O Multiplexing.
Instructor Materials Chapter 9: Transport Layer
Process-to-Process Delivery, TCP and UDP protocols
Review: TCP Client-Server Interaction
Concurrent Server Using Go-Back-N
Introduction of Transport Protocols
Transport Layer Our goals:
TCP - Part II Relates to Lab 5. This is an extended module that covers TCP flow control, congestion control, and error control in TCP.
Overview Jaringan Komputer (2)
CS4516 Program 2 Help Session (C10)
CS4470 Computer Networking Protocols
CS4514 Project 2 Help Session (B07)
Socket Programming.
CSS432 (Link Level Protocols) Reliable Transmission Textbook Ch 2.5
CS4470 Computer Networking Protocols
TCP/IP Socket Programming in C
Concurrent Server (in APP) Using Go-Back-N (in DLL)
The Transport Layer Reliability
Chapter 5 Peer-to-Peer Protocols and Data Link Layer
Lecture 4 Peer-to-Peer Protocols and Data Link Layer
I/O Multiplexing We often need to be able to monitor multiple descriptors: a generic TCP client (like telnet) need to be able to handle unexpected situations,
Selective Repeat.
Presentation transcript:

Simulation of Datalink Layer Communication Speaker: Jae Chung CS4514 HELP Session 2 Simulation of Datalink Layer Communication Speaker: Jae Chung

Description You are supposed to implement a Positive Acknowledgement with Retransmission (PAR) protocol on top of an emulated physical layer. PAR: the receiver acknowledge only the correctly received segments and the sender use timeout to detect the lost segment to be retransmitted. Physical layer: An error module + TCP connection. Your programs should compile and work on garden.WPI.EDU. 5/3/2019 WPI

Don’t put everything in one Super main() Framework Don’t put everything in one Super main() Network Layer Datalink Layer Physical Layer Client Server 5/3/2019 WPI

Network Layer Client Server testdata.raw server.out read (pkt) write (pkt) Network Layer Network Layer nwl_recv(pkt) pkt pkt 5/3/2019 WPI

Datalink Layer Client Server Network Layer Network Layer pkt dll_send(pkt) Datalink Layer dll_recv(frm) frm ack 5/3/2019 WPI

Physical Layer Client Server TCP Connection Datalink Layer phl_send(frm) phl_recv(ack) phl_send(ack) phl_recv() frm ack 5/3/2019 WPI

Testdata File Pkt_num the number of packets Packet_i_len the byte number of the i-th packet. Packet_i the i-th packet in raw byte form 2 {one byte} 38 {one byte} CS4514, computer network course, FL320 {38 bytes} 31 Worcester Polytechnic Institute 5/3/2019 WPI

Example: Read testdata.raw /cs/cs4514/pub/example/getData.c main(int argc, char **argv) { int fp, i; unsigned char packets[205]; unsigned char byteNum; unsigned char p; if ((fp = open(argv[1], O_RDONLY)) < 0) { fprintf(stderr, "Open testData error!“); printf("Usage: %s filename\n", argv[0]); exit(-1); } 5/3/2019 WPI

Example: Read testdata.raw (Cont) read(fp, &p, 1); printf("The total number of packets is: %d\n\n", p); for (i = 0; i < p; i++) { read(fp, &byteNum, 1); printf("The length of %dth packet : %d\n", i+1,byteNum); read(fp, packets, byteNum); packets[byteNum] = '\0'; printf("The content of %dth packet : %s\n\n", i+1,packets); } close(fp); 5/3/2019 WPI

Client: dll_send(pkt, …) 1. Split a packet into payloads phl_send(frm, …): Force bit error every 8-th Frame 2. For each payload 2.1 Create Frame (frm) 2.2 Start a Timer 2.2.1 Timeout Handler: phl_send(frm, …) 2.3 phl_send(frm, …) 2.4 phl_recv(ack, …) ack ok? no client.log yes 5/3/2019 WPI

Create Frame 1. Compute Seq Number and End-Of-Packet (EOP) byte Datafield 1. Compute Seq Number and End-Of-Packet (EOP) byte Seq EOP Datafield 2. Error-Detection (ED) byte (XOR on Seq+EOP+Data) Seq EOP Datafield ED 3. Byte Stuffing on Seq+EOP+Data+ED Bytes after stuffing 4. Add Start-Flag (SF) and End-Flag (EF) SF Bytes after stuffing EF 5/3/2019 WPI

Server: dll_recv(frm, …) 1. Un-stuff frm phl_send(frm, …): Force bit error every 7-th Frame 2. Compute ED byte ED ok? Return no yes server.log Dup? Drop frm yes no 3. Create ACK Frame (ack) 4. phl_send(ack, …) no EOP? 5. Reassemble the packet yes 6. nwl_recv(pkt, …) 5/3/2019 WPI

Create ACK Frame 1. Compute Seq Number 2. Error-Detection (ED) byte (ED = Seq) Seq ED 3. Byte Stuffing on Seq+ED Bytes after stuffing 4. Add Start-Flag (SF) and End-Flag (EF) SF Bytes after stuffing EF 5/3/2019 WPI

Timers The client use a timer to detect a frame loss. The client sets a timer when transmit a frame. When the timer expires, the client retransmit the frame. Two kinds of timer Select: easier to use Signal and Timer: nicer implementation 5/3/2019 WPI

Select: Monitor Given FDs (SDs) # include <sys/select.h> # include <sys/time.h> int select ( int maxfdp1, fd_set *readset, fd_set *writeset, fd_set *exceptset, const struct timeval *timeout); struct timeval { long tv_sec; /* seconds */ long tv_usec; /* microseconds */ } 5/3/2019 WPI

Example: Select fd_set bvfdRead; int readyNo; struct timeval timeout; int sockfd; while (1) { timeout.tv_sec = 0; timeout.tv_usec = 500; FD_ZERO(&bvfdRead); FD_SET(sockfd, &bvfdRead); readyNo = select(sockfd+1, &bvfdRead, 0, 0, &timeout); if(readyNo < 0) error_handler(); else if(readyNo == 0) timeout_handler(); else { FD_ZERO(&bvfdRead); receive_handler(); } 5/3/2019 WPI

Signal and Timer: Soft Interrupt Head files #include <sys/signal.h> #include <sys/time.h> #include <sys/timers.h> Register a function to TIMEOUT signal signal (SIGALRM, timeout); Create a timer and begin to run timer_create(); timer_settime(); 5/3/2019 WPI

Example: Signal and Timer gcc ex_timer.c -lrt timer_t timer_id; void timeout(){ printf("\n Time out!!!!\n"); exit(0); } void start_timer(){ struct itimerspec time_val; signal (SIGALRM, timeout); timer_create( CLOCK_REALTIME, NULL, &timer_id); /* set timeout to 1 second */ time_val.it_value.tv_sec = 1; time_val.it_value.tv_nsec = 0; time_val.it_interval.tv_sec = 0; time_val.it_interval.tv_nsec = 0; timer_settime(timer_id, 0, &time_val, NULL); } main(){ start_timer(); while(1); 5/3/2019 WPI