Concurrent Server Using Go-Back-N

Slides:



Advertisements
Similar presentations
Copyright 1999, S.D. Personick. All Rights Reserved. Telecommunications Networking II Lecture 32 Transmission Control Protocol (TCP) Ref: Tanenbaum pp:
Advertisements

CSCE 515: Computer Network Programming TCP Details Wenyuan Xu Department of Computer Science and Engineering.
Global Employee Location Server Jeff Zhou 3/19/2011 CS4516 HELP Session 1 Modified based on CS4514 B05 slides.
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.
Reliable Networking Tom Roeder CS sp. Last minute questions on Part II?
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.
CS 311 – Lecture 18 Outline IPC via Sockets – Server side socket() bind() accept() listen() – Client side connect() Lecture 181CS Operating Systems.
CS4514 Assignment 2 Help Session – Data Link Layer Client and Server Processes Speaker: Hao Shang Date: Nov. 11th, 2004.
Computer Networks Transport Layer. Topics F Introduction  F Connection Issues F TCP.
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.
TCP: Software for Reliable Communication. Spring 2002Computer Networks Applications Internet: a Collection of Disparate Networks Different goals: Speed,
1 CS4514 Project 2 Help Session (B05) Mingzhe Li Nov 10, 2005.
Chapter 26 Client Server Interaction Communication across a computer network requires a pair of application programs to cooperate. One application on one.
CS4516: Medical Examiner Client/Server Evan Frenn 1.
Socket Programming References: redKlyde ’ s tutorial set Winsock2 for games (gamedev.net)
Assignment 3 A Client/Server Application: Chatroom.
Elementary TCP Sockets
UNIX Network Programming1 UNIX Network Programming 2nd Edition.
LWIP TCP/IP Stack 김백규.
LWIP TCP/IP Stack 김백규.
1 CS3516 Project 3 Help Session (B14) Dongqing Xiao Dec 04, 2014.
Server Sockets: A server socket listens on a given port Many different clients may be connecting to that port Ideally, you would like a separate file descriptor.
Programming with TCP – III 1. Zombie Processes 2. Cleaning Zombie Processes 3. Concurrent Servers Using Threads  pthread Library Functions 4. TCP Socket.
Chapter 5 Peer-to-Peer Protocols and Data Link Layer PART I: Peer-to-Peer Protocols ARQ Protocols and Reliable Data Transfer Flow Control.
Networking Fundamentals. Basics Network – collection of nodes and links that cooperate for communication Nodes – computer systems –Internal (routers,
Networking Basics CCNA 1 Chapter 11.
Client/Server Socket Programming Project
CS 6401 Introduction to Computer Networks 09/21/2010 Outline - UNIX sockets - A simple client-server program - Project 1 - LAN bridges and learning.
Intro to Socket Programming CS 360. Page 2 CS 360, WSU Vancouver Two views: Server vs. Client Servers LISTEN for a connection and respond when one is.
Transport Layer: Sliding Window Reliability
Fork(), Concurrent Server, Normal Termination ( 금 ) 김 희 준
1 CS3516 Project 3 Help Session (A15) Dongqing Xiao Sep 30th,2015.
TCP/IP1 Address Resolution Protocol Internet uses IP address to recognize a computer. But IP address needs to be translated to physical address (NIC).
Data Link Layer.
ECE 297 Concurrent Servers Process, fork & threads ECE 297.
Powerpoint Templates Page 1 Powerpoint Templates CS Networks Laboratory HANDLED BY, A.MAHESH PRIYA L/IT.
Chapter 9: Transport Layer
Computer Communication & Networks
Part III Datalink Layer 10.
Sockets and Beginning Network Programming
6 Transport Layer Computer Networks Tutun Juhana
Data Link Layer What does it do?
Introduction of Transport Protocols
Transport Layer Our goals:
Data Link Layer: Data Link Control
Overview Jaringan Komputer (2)
UNIX Sockets Outline Homework #1 posted by end of day
Chapter 5 (part 1) TCP Client /Server Example By: Lim Meng Hui.
CS4516 Program 2 Help Session (C10)
Process-to-Process Delivery:
CGS 3763 Operating Systems Concepts Spring 2013
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
Chapter 5 Transport Layer Introduction
Getting Connected (Chapter 2 Part 3)
Chapter 3 Socket API © Bobby Hoggard, Department of Computer Science, East Carolina University These slides may not be used or duplicated without permission.
Concurrent Server (in APP) Using Go-Back-N (in DLL)
Simulation of Datalink Layer Communication Speaker: Jae Chung
Introduction to Computer Networks
Chapter 5 Peer-to-Peer Protocols and Data Link Layer
Lecture 4 Peer-to-Peer Protocols and Data Link Layer
Exceptions and networking
Presentation transcript:

Concurrent Server Using Go-Back-N CS4514 HELP Session 3 Concurrent Server Using Go-Back-N Feng Li lif@cs.wpi.edu 12/01/2004

Description Objective: To implement a simple concurrent server and clients having four emulated network protocol stacks. Application layer: Read and execute commands Network layer: MessagePacket (send&recv) Datalink layer: Packet  Frame and Go-Back-N sliding window protocol Physical layer: TCP connection. Your programs should compile and work on any host of ccc.WPI.EDU. 9/17/2018

System Overview (1) Server Client1 (3) (2) fork() (4) fork() Client2 serverbase.txt script1.txt Server (1) Client1 (3) (2) fork() (4) fork() script2.txt Child Process1 Client2 Child Process2 Note: each child process keeps a separate copy of the DB. we do not keep data consistency for the serverbase This is automatically done by using fork() 9/17/2018

System Framework Client Server APP Layer APP Layer NW Layer NW Layer DLL DLL PHL PHL TCP Connection Four Layer stacks 9/17/2018

Concurrent Server (fork()) fork() will make a child process with memory copy. The initial serverbase will be copied to each child process. fork() will return child pid in parent process and 0 in child process. Remember to close socket after using. More information could be found at fork(2). 9/17/2018

ACKing next frame expected Go Back N Go-Back-3: 3 frames are outstanding; so go back 3 fr fr 1 fr 2 time fr 3 fr 4 fr 5 fr 3 fr 4 fr 5 fr 6 fr 7 fr 8 fr 9 A B ACK1 ACK2 ACK3 Out-of-sequence frames ACK4 ACK5 ACK6 ACK7 ACK8 ACK9 error ACKing next frame expected 9/17/2018

Clienti Server How the System Works: Layer by Layer Application Layer ACK Clienti Server Child Process i Stop-Wait Read “scripted action” from file “scripti.txt” Read/Write a message APP APP Client Request: cmd No. [msg] nwl_send (… msg …) nwl_recv (… msg …) msg1::John… msg2::[ACK] msg3::[ACK] cmd::r / w/ q [1-12]… msg1::r[6] msg2::w[4]Duke… msg3::q NO sequence# for msg Note: The max_size of a message is 270 bytes The number referring to triple position is 1 to 12 9/17/2018

Clienti Server How the System Works: Layer by Layer Network Layer Message Message NWL NWL n_packets n_packets Tasks for NWL Disassemble and assemble packets from Msg. No response in this layer No sequence no. for packets End of Message Can be an special packet, OR a special position in each packet, eg. 1st byte dll_send (… pkt …) dll_recv (… pkt …) Note: The max_size of a packet is 90 bytes, The network layer will send packets until blocked by the Data Link Layer. But HOW? 9/17/2018

Clienti Server How the System Works: Layer by Layer DataLink Layer ACK Go-Back-N packet packet DLL DLL n_frames n_frames End of Packet Error Detection Byte Stuffing Go-Back-N(N>=3) phl_send (… frm …) phl_recv (… frm …) Note: The max_size of a frame payload is 40 bytes Sliding window size >=3 9/17/2018

How the System Works: Layer by Layer Clienti Server frame frame PHL PHL Identify client when start Force Single Bit Errors - Client: 4th frames - Server: 7th frames read (… data …) write (… data …) TCP Connection 9/17/2018

How the Functions Work: Layer by Layer client APP server child process APP Read script file fork() Pick a command nwl_recv(……) q cmd? q cmd? No Yes No Yes Build Msg Build Msg nwl_send(…msg…) nwl_send(…msg…) nwl_recv(…ack…) 9/17/2018

How the Functions Work: Layer by Layer nwl_send (… msg …) nwl_recv (… msg …) Split msg into pkts Pick a pkt Yes Last pkt? Chang EOM dll_send(…pkt…) No dll_recv (… pkt …) Return msg to APP Reassemble pkts into msg Last pkt? No Yes Note: you need have a mechanism to decide the last packet in a frame. 9/17/2018

How the Functions Work: Layer by Layer dll_send (… pkt … ) Split a packet into payloads Sliding window size =1 Create a new frame Start a Timer Send a frame to PHL phl_send (…) Wait for receiving a ACK frame phl_recv (…) Retransmit frames if timeout or error ACK frame! Receive a ACK frame correctly, then continue ... 9/17/2018

How the Functions Work: Layer by Layer dll_recv (… pkt … ) Receive a frame from PHL phl_recv (…) Unstuffing the frame Compute ED byte and check error Drop if error detected Drop if duplicate, else send ACK phl_send (…) Reassemble the packet If EOP, forward the packet to NWL 9/17/2018

Log Significant Events clienti.log serveri.log Performance Timing Packet Sent …… Frame received in error 9/17/2018

Project Tips-1 Sliding Window Protocol: Go-Back-N (N>=3) Try to implement Go-Back-1 first Then implement Go-Back-N (multiple timers) Maybe easier to merge PHL and DLL How to terminate client process: When the client gets the response to the quit message A “clean” way to terminate the server child process? 9/17/2018

Project Tips-2 Simulate multiple timer in software Approach I Using link list or array pp.223 on textbook() Need signal() Approach II Update the struct timeval for next select() call 9/17/2018

Project Tip3 How could the NWL Keep sending packets until blocked by the Data Link Layer ? Our suggestion is that you could use pipe to implement it: NWL keeps writing packets to the pipe until the pipe is full. A simple code of pipe could be found at http://thor.prohosting.com/~nupshot21/Unix/sockets/node46.shtml Pipe is more like a socket between local processes. 9/17/2018

Concurrent TCP Server Example (fork) pid_t pid; int listenfd, connfd;  /* 1. create a socket socket() */ if ((listenfd = socket(AF_INET, SOCK_STREAM, 0)) < 0 ) err_quit("build server socket error\n", -1); /* 2. fill in sockaddr_in{ } with server's well-known port */  … /* 3. bind socket to a sockaddr_in structure bind() */ bind (listenfd, ...); /* 4. specify the backlog of incoming connection requests listen() */ listen (listenfd, LISTENQ);  while(1){ connfd = accept(listenfd, ... ); /* probably blocks */ if(( pid = fork()) == 0){ close(listenfd); /* child closes listening socket */ doit(connfd); /* process the request */ close(connfd); /* done with this client */ exit(0); } close(connfd); /* parent closes connected socket */ 9/17/2018