Network LayerDatalink LayerPhysical LayerNetwork LayerDatalink LayerPhysical Layer ClientServer Framework.

Slides:



Advertisements
Similar presentations
Lab 2: Admin details Lab 2 is out! Due: o November 4th, 12 noon o November 6th, 12 noon (90% cap) Assignment and starter code online Start early! On average,
Advertisements

Lab tutorial Lab assignment 2 Fall 2006
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)
Advanced Sockets Amit Mondal TA, Intro to Networking Jan 22, 2009 Recital 3 Introduction to Networking Instructor: Prof. Aleksandar Kuzmanovic.
Page: 1 Director 1.0 TECHNION Department of Computer Science The Computer Communication Lab (236340) Summer 2002 Submitted by: David Schwartz Idan Zak.
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.
I/O Multiplexing Capability of tell the kernel that wants to be notified when one or more I/O conditions are ready. For example, I/O data is available.
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.
TCP connection my Computertelnet client web server remote computer 1 character per transmission Telnet uses TCP connection.
1 CS4514 – B03 Project 2 Help Session Choong-Soo Lee November 24, 2003.
TCP connection my Computertelnet client web server remote computer 1 character per transmission * Telnet uses TCP connection * but Nagle's algorithm modifies.
Computer Networks Sockets. Outline F Socket basics F Socket details.
Lecture 8 UDP Sockets & I/O Multiplexing
1 CS4514 Project 2 Help Session (B05) Mingzhe Li Nov 10, 2005.
CS Computer Networks I Georgia Tech CS Computer Networks 1: Sockets Programming Adapted from slides by Professor Patrick Traynor.
IP Multiplexing Ying Zhang EECS 489 W07.
Project 2: A P2P Chat Application Review Ananth Rao.
CS4516: Medical Examiner Client/Server Evan Frenn 1.
1 Networking (Stack and Sockets API). 2 Topic Overview Introduction –Protocol Models –Linux Kernel Support TCP/IP Sockets –Usage –Attributes –Example.
CS 4396 Computer Networks Lab
1 CS3516 Project 3 Help Session (B14) Dongqing Xiao Dec 04, 2014.
TCP1 Transmission Control Protocol (TCP). TCP2 Outline Transmission Control Protocol.
Transmission Control Protocol
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.
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.
CS 453 Computer Networks Lecture 9 Layer 2 – Data Link Layer.
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.
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.
Networking Basics CCNA 1 Chapter 11.
CS492b Project #3-2 KIP router KAIST Dept. of CS NC Lab.
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,
Today’s topic: UDP Reliable communication over UDP.
CMPT 471 Networking II Network Programming © Janice Regan,
2: Application Layer 1 Socket Programming UNIX Network Programming, Socket Programming Tutorial:
回到第一頁 Client/sever model n Client asks (request) – server provides (response) n Typically: single server - multiple clients n The server does not need.
Socket Programming. Computer Science, FSU2 Interprocess Communication Within a single system – Pipes, FIFOs – Message Queues – Semaphores, Shared Memory.
1 Spring Semester 2008, Dept. of Computer Science, Technion Internet Networking recitation #7 Socket Programming.
1 CS3516 Project 3 Help Session (A15) Dongqing Xiao Sep 30th,2015.
I/O Multiplexing.
Sockets and Beginning Network Programming
Review: TCP Client-Server Interaction
Concurrent Server Using Go-Back-N
Network Programming CSC- 341
Lecture 4 Socket Programming Issues
CS4516 Program 2 Help Session (C10)
Chapter 5 Peer-to-Peer Protocols and Data Link Layer
CS4514 Project 2 Help Session (B07)
Lecture 11 Overview.
Socket Programming.
CSS432 (Link Level Protocols) Reliable Transmission Textbook Ch 2.5
TCP/IP Socket Programming in C
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,
Programming Assignment #2
Presentation transcript:

Network LayerDatalink LayerPhysical LayerNetwork LayerDatalink LayerPhysical Layer ClientServer Framework

PHL TCP Connection ClientServer 2. phl_send(…) 3. phl_recv(…) 1. phl_connect(…) 4. phl_close(…) Physical Layer NOTE: Real TCP does the actual transmission for your PHL.

ClientServer NWL 3. dll_send(… pkt …)4. dll_recv(… pkt …) 2. read packets from file “testdata.raw” 5. write packets to file “server.out” 1. phl_connect(…) 6. phl_close(…) Network Layer

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 38 CS4514, computer network course, FL Worcester Polytechnic Institute

The testdata.raw file 0x02 0x47 0x4F 0x03 0x72 0x61 0x77 2 (packets) 2 (bytes) ‘G’ ‘O’ 3 (bytes) ‘r’ ‘a’ ‘w’

Client dll_send(… pkt … ) 1. Split a packet into payloads 2. Create a new frame 4. Send the frame to PHL 5. Wait for receiving a ACK frame 6. Retransmit it if timeout !! 3. Start a Timer 7. Receive a ACK frame phl_send(…) phl_recv(…) Force some error Every 6-th Frame client.log Correct Ack Frm? Yes No

Create a new frame struct frame { unsigned char start-flag; unsigned char seq; unsigned char crc; unsigned char data[]; unsigned char end-of-pkt; unsigned char end-flag; } Start-flag seq crcdatafield end-of-pkt end-flag NOTE: Byte-stuffing includes those bytes of seq, crc, data, end-of-pkt. 1. Put a payload in a frame 2. End-of-packet byte = ? 3. Compute CRC 4. Byte-stuffing Process

Create a new ACK frame struct ackframe { unsigned char start-flag; unsigned char seq; unsigned char crc; unsigned char end-flag; } start-flag seqcrcend-flag 1. Compute CRC 2. Byte-stuffing Process

Server dll_recv(…pkt…) 1. Receive a frame from PHL 3. Compute CRC and check it 4. Drop it if there’s an CRC error 6. Reassemble the packet 7. If end-of-packet, return and forward the packet to the Network Layer. phl_send(…) phl_recv(…) 2. Unstuffing the frame server.log 5. Check whether it’s duplicate. If yes, drop it. Send ACK frame Force some error Every 7-th ACK Frame

System call: select In this assignment, you can call select and tell the kernel to return only when: - the socket descriptor in physical layer is ready for reading, or - a preset timer timeout

System call: select # include int select ( int maxfdp1, fd_set *readset, fd_set *writeset, fd_set *exceptset, const struct timeval *timeout);

Struct timeval struct timeval { long tv_sec; /* seconds */ long tv_usec; /* microseconds */ }

Example: how to use select { fd_set bvfdRead; FD_SET(sockfd, &bvfdRead); int readyNo; readyNo = select(sockfd+1, struct timeval timeout; &bvfdRead, 0, 0, &timeout); int sockfd; if(readyNo < 0) //some errors error_handler; while (true) { else if(readyNo = = 0) // timeout timeout.tv_sec = 0; timeout_handler; timeout.tv_usec = 500; else // receive data from socket FD_ZERO(&bvfdRead); receive_handler; } }