CS4514 Assignment 2 Help Session – Data Link Layer Client and Server Processes Speaker: Hao Shang Date: Nov. 11th, 2004.

Slides:



Advertisements
Similar presentations
The Data Link Layer Chapter 3. Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control.
Advertisements

CIS 725 Data Link Layer. Physical Layer Figure 3-1 B. Forouzan, TCP/IP Protocol Suite.
I/O Models Satish Krishnan. I/O Models Blocking I/O Non-blocking I/O I/O Multiplexing Signal driven I/O Asynchronous I/O.
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.
TDC561 Network Programming Camelia Zlatea, PhD Week 3: Unix Asynchronous Events; Signals and Alarms API.
CS4514-Help Session By Huahui Wu. Description In this project, you are supposed to implement a PAR (Positive Acknowledgement with Retransmission)
Transport Layer 3-1 Transport Layer r To learn about transport layer protocols in the Internet: m TCP: connection-oriented protocol m Reliability protocol.
I/O Multiplexing© Dr. Ayman Abdel-Hamid, CS4254 Spring CS4254 Computer Network Architecture and Programming Dr. Ayman A. Abdel-Hamid Computer Science.
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.
Signal Signal : - is a notification sent to a process to notify it of some event - interrupts whatever the process is doing and force it to handle a signal.
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.
Reliable Data Transfer Protocol IMPLEMENTATION TIPS.
CS4516: Medical Examiner Client/Server Evan Frenn 1.
CS 4396 Computer Networks Lab
Chapter 11: Flow Control – can occur at layer 2 (data link) and at layer 4 (transport)  You saw the need in the most recent assignment.  Data packets.
CS/EE 145A Reliable Transmission over Unreliable Channel Netlab.caltech.edu/course.
1 CS3516 Project 3 Help Session (B14) Dongqing Xiao Dec 04, 2014.
Chi-Cheng Lin, Winona State University CS 313 Introduction to Computer Networking & Telecommunication Data Link Layer Part I – Designing Issues and Elementary.
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.
The data link layer. Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control.
The Data Link Layer Chapter 3 10/28/2015www.noteshit.com1.
Remote Shell CS230 Project #4 Assigned : Due date :
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.
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.
I/O Multiplexing. TCP Echo Client: I/O operation is sequential !! tcpcliserv/tcpcli01.c: lib/str_cli.c: TCP Client TCP Server stdin stdout fgets fputs.
Data Link and Flow Control Networks and Protocols Prepared by: TGK First Prepared on: Last Modified on: Quality checked by: Copyright 2009 Asia Pacific.
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,
Cs423-cotter1 Concurrency Issues in Client/Server Applications Chapters 15,16, 28.
Copyright ©: Nahrstedt, Angrave, Abdelzaher, Caccamo1 Timers and Clocks II.
University of Texas at Austin CS 378 – Game Technology Don Fussell CS 378: Computer Game Technology SDL_net Client-Server Example Spring 2012.
Today’s topic: UDP Reliable communication over UDP.
Transport Layer 3-1 Internet Transport Layer Lecture 8 Dr. Najla Al-Nabhan.
The Data Link Layer Chapter 3 1/21/2016www.ishuchita.com1.
CMPT 471 Networking II Network Programming © Janice Regan,
Transport Layer: Sliding Window Reliability
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.
Computer Networking Lecture 16 – Reliable Transport.
Chapter 3: The Data Link Layer –to achieve reliable, efficient communication between two physically connected machines. –Design issues: services interface.
I/O Multiplexing.
Process-to-Process Delivery, TCP and UDP protocols
Concurrent Server Using Go-Back-N
Chapter 3 – Part 1 The Data Link Layer.
Transport Layer Our goals:
Overview Jaringan Komputer (2)
Lecture 4 Socket Programming Issues
CS4516 Program 2 Help Session (C10)
CS412 Introduction to Computer Networking & Telecommunication
Chapter 5 Peer-to-Peer Protocols and Data Link Layer
CS4514 Project 2 Help Session (B07)
CSS432 (Link Level Protocols) Reliable Transmission Textbook Ch 2.5
Concurrent Server (in APP) Using Go-Back-N (in DLL)
Simulation of Datalink Layer Communication Speaker: Jae Chung
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,
Presentation transcript:

CS4514 Assignment 2 Help Session – Data Link Layer Client and Server Processes Speaker: Hao Shang Date: Nov. 11th, 2004

2 Goal  Implement data link layer based on PAR protocol (Positive Acknowledgement with Retransmission) PAR: a working stop-and-wait protocol over un unreliable channel. Ref to Figure3-12 in textbook. Error detection: 1 byte xor Framing: 80bytes max payload, flag bytes [0x7E] with byte stuffing  Physical layer is emulated by a TCP connection plus an error module.

3 Framework Network Layer Data Link Layer Physical Layer Network Layer Data Link Layer Physical Layer ClientServer

4 Network Layer ClientServer server.out Network Layer read (pkt) Network Layer nwl_recv(pkt) testdata.raw pkt write (pkt) pkt

5 Data Link Layer ack ClientServer Network Layer Data Link Layer dll_send(pkt) Data Link Layer dll_recv(frm) Network Layer frm pkt

6 Physical Layer TCP Connection ClientServer Datalink Layer Physical Layer phl_send(frm) phl_recv(ack) Physical Layer phl_send(ack) phl_recv() Datalink Layer frmack

7 Testdata File  Pkt_numthe number of packets  Packet_i_lenthe byte number of the i-th packet  Packet_ithe i-th packet in raw byte form 2{one byte} 38{one byte} CS4514, computer network course, FL320{38 bytes} 31{one byte} Worcester Polytechnic Institute{31 bytes}

8 Example: Read testdata_simple.raw  ccc:/cs/cs4514/pub/proj2test/getData.c main(int argc, char **argv) { int fp, i; unsigned char packets[221]; 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); } read(fp, &p, 1); printf("The total number of packets is: %d\n\n", p);

9 Example: Read testdata_simple.raw (continued) 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); //the following two lines are applicable for printable packets only packets[byteNum] = '\0'; printf("The content of %dth packet : %s\n\n", i+1,packets); } close(fp); } Raw file: ccc:/cs/cs4514/pub/proj2test/testData_simple.raw Another example: ccc:/cs/cs4514/pub/proj2test/getData_v1.c NOTE: Packets may not be printable characters

10 Client: dll_send(pkt, …) 2. For each payload 2.3 Start a Timer phl_send(frm, …): Force bit error every 6-th Frame client.log ack ok? 1. Split a packet into payloads 2.1 Create Frame (frm) 2.4 phl_recv(ack, …) no yes Timeout Handler: phl_send(frm, …) restart the timer 2.2 phl_send(frm, …) Stop the timer

11 Create Frame DatafieldSeq 1. Compute Seq Number and End-Of-Packet (EOP) byte EOP SeqEOPED Bytes after stuffing FF 2. Error-Detection (ED) byte (XOR on Seq + EOP + Data) 3. Byte Stuffing on Seq + EOP + Data + ED 4. Add Frame-Flag (FF) 0x7E at both ends Datafield EOP: End of PacketED: Error Detection FF: frame flag

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

13 Create ACK Frame Seq ED Bytes after stuffing FF 2. Error-Detection (ED) byte (ED = Seq) 1. Compute Seq Number 3. Byte Stuffing on Seq+ED 4. Add Frame-Flag (FF) 0x7E at both ends EOP: End of PacketED: Error Detection FF: Frame Flag

14 Timers  The client uses a timer to detect a frame loss. The client sets a timer when it transmits a frame. When the timer expires, the client retransmits the frame.  Two kinds of timer Select : block Signal and Timer: non-block

15 Select: Monitor Given FDs (SDs) # include 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 */ }

16 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(); }

17 Signal and Timer: Soft Interrupt  Head files #include  Register a function to TIMEOUT signal signal (SIGALRM, timeout);  Create a timer and begin to run timer_create(); timer_settime();  Compile with option “-lrt” (link runtime library)

18 Example: Signal and Timer timer_t timer_id; void timeout(int signal_number){ printf("\n SIGNUM: %d\n", signal_number); 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; /* set both fields of it_value 0 to disarm the alarm */ 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); }

19 Questions