3COM0271 Computer Network Protocols & Architectures A
|
|
- Maria Fleming
- 6 years ago
- Views:
Transcription
1 3COM0271 Computer Network Protocols & Architectures A Week 4: Bit Stuffing and Un-stuffing Practical You should be familiar with the idea of framing from Chapter 2 of Peterson and Davie and also from the lectures. Using a flag character is one way of doing framing. But to ensure transparency, it requires bit stuffing. You are expected to spend some time doing task A before moving on to task B. In task A, you will understand how framing with flags and bit stuffing works and in task B, you are to put together the fragments of C code that have been provided to make up a complete programs that performs the un-stuffing simulation. TASK A: Simulation of Bit Stuffing and Un-Stuffing In this section, you will be simulating a bit stuffing and un-stuffing example using UNIX pipes. The files you need are available from: Five programs are presented: encoder channel decoder bitstuff unstuff This represents the data source. It takes hexadecimal in, and outputs it as binary. This represents the binary channel. It does not preserve the line boundaries in the input. This represents the receiver of the data. It takes binary input from the channel, and outputs it as hexadecimal. This takes lines of binary input, and outputs binary with a flag character between each line of input ands with a zero stuffed after any 5 consecutive 1 bits in the data. This takes binary input, and outputs it as binary, inserting a new line wherever a flag is encountered on the input, and removing stuffed bits. Note: bitstuff and unstuff are only available as compiled programs -- you will need to write the source code yourself. 1. Compile the encoder and decoder programs, using: gcc -o encoder encoder.c gcc -o decoder decoder.c Each of these programs takes input from standard input, and sends output to standard output. In not connected to a pipe, standard input (and output) will be from (and to) the terminal. Use ^D (Control and D) to mark end of input from the terminal. Test the encoder and decoder programs; first separately, to confirm that you are familiar with hex numbers, and then use the two programs in a pipeline (as shown below) to verify that together they implement a null transformation (i.e. that one is the inverse of the other). encoder decoder decoder encoder hexadecimal input, hexadecimal output binary input, binary output (which, because of buffering, may not appear until input is ended with ^D)
2 2. Compile the channel program, and test it. See that if it is part of the pipeline, the boundaries between blocks of data from the encoder are lost. The channel has fixed size (16 bit) messages; it is easier to understand what is happening if your first message is at least 5 hex digits long. gcc -o channel channel.c encoder channel decoder 3. Understand the framing problem: you are going to design and implement a program that will separate the received data into separate messages. This would then be tested as follows: encoder insert-markers channel remove-markers decoder There are two folders, one called PC-Linux and one called Sparc-SunOS, containing executable versions of the programs. In these you can find the bitstuff and unstuff programs that implement the insert-markers and remove-markers functions. Download the bitstuff and unstuff programs from the PC-Linux folder. Try encoder bitstuff. See how the flag characters is inserted after each line of input and how input containing long sequences of 1 bit is expanded by the insertion of 0 bits. These 0 bits have to be removed at the receiving end. Then, try unstuff with input and output to the terminal, so that you can see what it is doing. 4. How much increase in length is caused by framing and bit stuffing? Assuming we count the flag at the beginning of a frame and the flag at the end of the frame, how many bits have to be in a frame for the overhead to drop to 30% of the total length? TASK B: Un-Stuffing Simulation Programming In this section, you are to write a un-stuff program that will remove the markers in the bit stream as well as the stuffed 0 after five consecutive 1 s. The bit stuffing program in C is provided at the end of this handout as a guide to help you get started. All the code fragments to do the un-stuff program are given; your task is to put them in the right order and test it as follows! Un-stuff C code fragments encoder insert-markers channel remove-markers decoder The C codes to do un-stuffing are broken into several fragments. By counting 1s and 0s and their combination, the unstuffing program is required to read framed and stuffed binary from stdin replace the flag by a new line replace the 0 after five consecutive 1s by output the original binary data to stdout (i) You should include the following header library #include <stdio.h> (ii) You should define some variables static int ch, count0, count1; //state shared with utility function // ch: the channel input bit // count0: counter of 0s // count1: counter of 1s
3 (iii) Every C program will need a main function as the program entrance and will look something like this main ()... // this is where your code fragments is placed (iv) There is a function to output the buffered bits to the stdout. The function is defined as: flushbuffer() // function to output the buffered bits if (count0==1) printf("0"); count0=0; while (count1>0) printf("1"); count1--; (v) The buffer is switched off and reset after the program starts. setbuf(stdout, NULL); // switch off output buffering count0 = count1 = 0; // empty buffer (vi) This is used to read input from stdin while ((ch = getchar ())!= EOF) // start the while loop... // your code goes here (vii) This is used to flush the buffer after the while loop and before the program finishes (viii) This is the if-statement when the input digit is 1, add it to the buffer if (ch == '1') count1++; // "1" add it to the buffer (ix) And you may need an if-statement when the input digit is 0. // If input is "0"... different cases to consider... if (count0==0 && count1==0) count0++; // empty buffer, buffer the new 0; else if (count0==1 && count1==0) count0++ else if (count1==5) // stuffed '0', empty buffer
4 else if (count0==1 && count1==6) // flag printf("nl\n"); count0=count1=0; else if (count1>5) printf("error\n"); count0=count1=0; else count0=1; (x) And another if-statement if the input digit is neither 0 or 1. if (ch!= '0' && ch!= '1') // (debug) newlines and invalid characters printf ("Z"); Some Extra Questions to do 1. Assuming a framing protocol that uses bit stuffing, show the bit sequence transmitted over the link when the frame contains the following bit sequence: The stuffed bits (zeros) are in bold: Suppose the following sequence of bits arrives over a link: Show the resulting frame after any stuffed bits have been removed. Indicate any errors that might have been introduced into the frame. The ^ marks each position where a stuffed 0 bit was removed. There were no stuffing errors detectable by the receiver; the only such error the receiver could identify would be seven 1 in a row ^ ^ ^ Suppose you want to send some data using the BISYNC framing protocol, and the last 2 bytes of your data are DLE and ETX. What sequence of bytes would be transmitted immediately prior to the CRC?..., DLE, DLE, DLE, ETX, ETX
5 4. For each of the following framing protocols, give an example of a byte/bit sequence that should never appear in a transmission? (a) BISYNC X DLE Y, where X can be anything besides DLE and Y can be anything except DLE or ETX. In other words, each DLE must be followed by either DLE or ETX. (b) HDLC ****************************** Bit-Stuffing C Program Example***************************** #include <stdio.h> main () int c; int count; //count the number of 1s setbuf(stdout, NULL); // switch off output buffering printf("\n "); // simulate the flag while ((c = getchar ())!= EOF) // read from stdin binary data switch (c) case '0': printf ("%c",c); // input is a '0' // reset counter // print to stdout the digit case '1': // input is a '1' printf ("%c", c); // print to stdout the digit count ++; // increase the counter by 1 if (count == 5) // after 5 consecutive 1s, insert one 0 printf("0"); // resets counter case '\n': printf (" "); // end of frame (EOF) // resets counter *************************************************************************************** NOTE: The unstuff program is available as a C file unstuff.c
Framing and Stuffing. Advanced Computer Networks
Framing and Stuffing Advanced Computer Networks Framing & Stuffing Outline Synchronous vs Asynchronous Transmissions Asynchronous Character Transmissions Framing Identifying Synchronous Block Boundaries
More informationDirect Link Networks. Framing. Lecture - Encoding & Framing 1. Problems. Areas for Discussion
Areas for Discussion Direct Link s Joseph Spring School of Computer Science 3COM0271 Computer Protocols & Architecture s Based on Chapter 2, Peterson & Davie, Computer s: A Systems Approach, 4 th Ed Problems
More informationCS113: Lecture 7. Topics: The C Preprocessor. I/O, Streams, Files
CS113: Lecture 7 Topics: The C Preprocessor I/O, Streams, Files 1 Remember the name: Pre-processor Most commonly used features: #include, #define. Think of the preprocessor as processing the file so as
More informationInst: Chris Davison
ICS 153 Introduction to Computer Networks Inst: Chris Davison cbdaviso@uci.edu ICS 153 Data Link Layer Contents Simplex and Duplex Communication Frame Creation Flow Control Error Control Performance of
More informationLecture 2: Links and Signaling
Lecture 2: Links and Signaling CSE 123: Computer Networks Alex C. Snoeren DISCUSSION @7pm Tomorrow Our Problem Communications is complicated Modulation and encoding bits Splitting sequences of bits into
More informationBinghamton University. CS-211 Fall Input and Output. Streams and Stream IO
Input and Output Streams and Stream IO 1 Standard Input and Output Need: #include Large list of input and output functions to: Read and write from a stream Open a file and make a stream Close
More informationCS246 Spring14 Programming Paradigm Files, Pipes and Redirection
1 Files 1.1 File functions Opening Files : The function fopen opens a file and returns a FILE pointer. FILE *fopen( const char * filename, const char * mode ); The allowed modes for fopen are as follows
More informationECE 4450:427/527 - Computer Networks Spring 2017
ECE 4450:427/527 - Computer Networks Spring 2017 Dr. Nghi Tran Department of Electrical & Computer Engineering Lecture 5.1: Link Layer Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer
More informationLecture / The Data Link Layer: Framing and Error Detection
Lecture 2 6.263/16.37 The Data Link Layer: Framing and Error Detection MIT, LIDS Slide 1 Data Link Layer (DLC) Responsible for reliable transmission of packets over a link Framing: Determine the start
More informationBinghamton University. CS-220 Spring Includes & Streams
Includes & Streams 1 C Pre-Processor C Program Pre-Processor Pre-processed C Program Header Files Header Files 2 #include Two flavors: #include Replace this line with the contents of file abc.h
More informationBinghamton University. CS-211 Fall Input and Output. Streams and Stream IO
Input and Output Streams and Stream IO 1 Standard Input and Output Need: #include Large list of input and output functions to: Read and write from a stream Open a file and make a stream Close
More informationDirect Link Networks. Lecture - Encoding & Framing 1. Areas for Discussion. Problems
Areas for Discussion Direct Link s Joseph Spring School of Computer Science 3COM0088 Computer Protocols & Architecture s Based on Chapter 2, Peterson & Davie, Computer s: A Systems Approach, 3 rd Ed Problems
More informationCSMC 417. Computer Networks Prof. Ashok K Agrawala Ashok Agrawala Set 4. September 09 CMSC417 Set 4 1
CSMC 417 Computer Networks Prof. Ashok K Agrawala 2009 Ashok Agrawala Set 4 1 The Data Link Layer 2 Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control
More informationData Link Layer Lecture 7
Data Link Layer Lecture 7 Recap Physical layer function in a nutshell: Position of the physical layer in TCP/IP Model Services (function) offered by Physical layer Position of the Data-Link Layer in TCP/IP
More informationData Link Layer. Indian Institute of Technology Madras
Data Link Layer Study of algorithms for achieving reliable, efficient communication between two adjacent machines at DLL. adjacent - two machines physically connected using a communication channel that
More informationChapter 9: Data Transmission
Chapter 9: Data Transmission MULTIPLE CHOICE 1. In practical terms, parallel data transmission is sent: a. over short distances only c. over any distance b. usually over long distances d. usually over
More informationFloating-point lab deadline moved until Wednesday Today: characters, strings, scanf Characters, strings, scanf questions clicker questions
Announcements Thursday Extras: CS Commons on Thursdays @ 4:00 pm but none next week No office hours next week Monday or Tuesday Reflections: when to use if/switch statements for/while statements Floating-point
More informationPhysics 6720 I/O Methods October 30, C++ and Unix I/O Streams
Physics 6720 I/O Methods October 30, 2002 We have been using cin and cout to handle input from the keyboard and output to the screen. In these notes we discuss further useful capabilities of these standard
More informationIslamic University of Gaza Faculty of Engineering Department of Computer Engineering ECOM 4021: Networks Discussion. Chapter 2.
Islamic University of Gaza Faculty of Engineering Department of Computer Engineering ECOM 4021: Networks Discussion Chapter 2 Getting Connected Eng. Haneen El-Masry March, 2014 2.2 ENCODING Encoding the
More informationStandard File Pointers
1 Programming in C Standard File Pointers Assigned to console unless redirected Standard input = stdin Used by scan function Can be redirected: cmd < input-file Standard output = stdout Used by printf
More informationCSE 12 Spring 2016 Week One, Lecture Two
CSE 12 Spring 2016 Week One, Lecture Two Homework One and Two: hw2: Discuss in section today - Introduction to C - Review of basic programming principles - Building from fgetc and fputc - Input and output
More informationData Link Layer: Overview, operations
Data Link Layer: Overview, operations Chapter 3 1 Outlines 1. Data Link Layer Functions. Data Link Services 3. Framing 4. Error Detection/Correction. Flow Control 6. Medium Access 1 1. Data Link Layer
More informationCSE 12 Spring 2018 Week One, Lecture Two
CSE 12 Spring 2018 Week One, Lecture Two Homework One and Two: - Introduction to C - Review of basic programming principles - Building from fgetc and fputc - Input and output strings and numbers - Introduction
More informationShould you know scanf and printf?
C-LANGUAGE INPUT & OUTPUT C-Language Output with printf Input with scanf and gets_s and Defensive Programming Copyright 2016 Dan McElroy Should you know scanf and printf? scanf is only useful in the C-language,
More informationCS 640 Introduction to Computer Networks. Role of data link layer. Today s lecture. Lecture16
Introduction to Computer Networks Lecture16 Role of data link layer Service offered by layer 1: a stream of bits Service to layer 3: sending & receiving frames To achieve this layer 2 does Framing Error
More informationDirect Link Networks: Building Blocks (2.1), Encoding (2.2), Framing (2.3)
Direct Link Networks: Building Blocks (2.1), Encoding (2.2), Framing (2.3) ECPE/CS 5516: Computer Networks Originally by Scott F. Midkiff (ECpE) Modified by Marc Abrams (CS) Virginia Tech courses.cs.vt.edu/~cs5516
More informationCOMP 2718: The OS, Shell, Terminal, and Text
COMP 2718: The OS, Shell, Terminal, and Text By: Dr. Andrew Vardy Adapted from the notes of Dr. Rod Byrne Outline What is an Operating System? The Shell and Terminal How are Characters Encoded? Standard
More informationSome portions courtesy Robin Kravets and Steve Lumetta
CSE 123 Computer Networks Fall 2009 Lecture 4: Data-Link I: Framing and Errors Some portions courtesy Robin Kravets and Steve Lumetta Administrative updates I m Im out all next week no lectures, but You
More informationCSE 123A Computer Networks
CSE 123A Computer Networks Winter 2005 Lecture 4: Data-Link I: Framing and Errors Some portions courtesy Robin Kravets and Steve Lumetta Last time How protocols are organized & why Network layer Data-link
More informationUNIT IV-2. The I/O library functions can be classified into two broad categories:
UNIT IV-2 6.0 INTRODUCTION Reading, processing and writing of data are the three essential functions of a computer program. Most programs take some data as input and display the processed data, often known
More informationPacket/Frame, Error Detection How to send data efficiently & reliably?
Packet/Frame, Error Detection How to send data efficiently & reliably? Packet and Packet Communication - Shared Network Resource, Fairness, Reliability Frame - Byte Oriented Frame and Bit Oriented Frame
More informationDATA LINK LAYER UNIT 7.
DATA LINK LAYER UNIT 7 1 Data Link Layer Design Issues: 1. Service provided to network layer. 2. Determining how the bits of the physical layer are grouped into frames (FRAMING). 3. Dealing with transmission
More informationIntro to C and Binary Numbers 8/27/2007
Intro to C and Binary Numbers 8/27/2007 1 Opening Discussion Let's look at three answers to the interclass question. What are the steps in building a C program? Do you have any questions about the class
More informationCSE 123: Computer Networks
Student Name: PID: UCSD email: CSE 123: Computer Networks Homework 1 Solution (Due 10/12 in class) Total Points: 30 Instructions: Turn in a physical copy at the beginning of the class on 10/10. Problems:
More informationCS102: Standard I/O. %<flag(s)><width><precision><size>conversion-code
CS102: Standard I/O Our next topic is standard input and standard output in C. The adjective "standard" when applied to "input" or "output" could be interpreted to mean "default". Typically, standard output
More informationHere's how you declare a function that returns a pointer to a character:
23 of 40 3/28/2013 10:35 PM Violets are blue Roses are red C has been around, But it is new to you! ANALYSIS: Lines 32 and 33 in main() prompt the user for the desired sort order. The value entered is
More informationLecture 03 Bits, Bytes and Data Types
Lecture 03 Bits, Bytes and Data Types Computer Languages A computer language is a language that is used to communicate with a machine. Like all languages, computer languages have syntax (form) and semantics
More informationChapter 2. Section 2.5 while Loop. CS 50 Hathairat Rattanasook
Chapter 2 Section 2.5 while Loop CS 50 Hathairat Rattanasook Loop Iteration means executing a code segment more than once. A loop is an iterative construct. It executes a statement 0..n times while a condition
More informationFast Communications Controller
Fast Communications Controller Purpose: The Fast Communications Controller HDLC Protocol module describes the use of the FCC when used in HDLC mode. Objectives: This will provide you with an understanding
More informationChapter 3. The Data Link Layer. Wesam A. Hatamleh
Chapter 3 The Data Link Layer The Data Link Layer Data Link Layer Design Issues Error Detection and Correction Elementary Data Link Protocols Sliding Window Protocols Example Data Link Protocols The Data
More informationComputer Programming: Skills & Concepts (CP) Files in C
CP 20 slide 1 Tuesday 21 November 2017 Computer Programming: Skills & Concepts (CP) Files in C Julian Bradfield Tuesday 21 November 2017 Today s lecture Character oriented I/O (revision) Files and streams
More informationInput / Output Functions
CSE 2421: Systems I Low-Level Programming and Computer Organization Input / Output Functions Presentation G Read/Study: Reek Chapter 15 Gojko Babić 10-03-2018 Input and Output Functions The stdio.h contain
More informationCSC209H Lecture 3. Dan Zingaro. January 21, 2015
CSC209H Lecture 3 Dan Zingaro January 21, 2015 Streams (King 22.1) Stream: source of input or destination for output We access a stream through a file pointer (FILE *) Three streams are available without
More informationBasic I/O. COSC Software Tools. Streams. Standard I/O. Standard I/O. Formatted Output
Basic I/O COSC2031 - Software Tools C - Input/Output (K+R Ch. 7) We know how to do some basic input and output: getchar - reading characters putchar - writing characters printf - formatted output Input
More informationComputer Network. Direct Link Networks Reliable Transmission. rev /2/2004 1
Computer Network Direct Link Networks Reliable Transmission rev 1.01 24/2/2004 1 Outline Direct link networks (Ch. 2) Encoding Framing Error detection Reliable delivery Media access control Network Adapter
More informationCSCI-1680 Physical Layer Link Layer I Rodrigo Fonseca
CSCI-1680 Physical Layer Link Layer I Rodrigo Fonseca Based partly on lecture notes by David Mazières, Phil Levis, John Janno< Administrivia Snowcast milestone today! 4-7pm Sign up at http://tinyurl.com/cs168-calendar
More informationLecture 2: C Programm
0 3 E CS 1 Lecture 2: C Programm ing C Programming Procedural thought process No built in object abstractions data separate from methods/functions Low memory overhead compared to Java No overhead of classes
More informationCSCE 491 Project Specification Fall 2002
CSCE 491 Project Specification Fall 2002 Dr. James P. Davis jimdavis@cse.sc.edu We will start our process of analysis, architecture and design in this course by quickly ramping the architecture for various
More informationLab Exam 1 D [1 mark] Give an example of a sample input which would make the function
Grade: / 20 Lab Exam 1 D500 1. [1 mark] Give an example of a sample input which would make the function scanf( "%f", &f ) return 0? Answer: Anything that is not a floating point number such as 4.567 or
More informationC Input/Output. Before we discuss I/O in C, let's review how C++ I/O works. int i; double x;
C Input/Output Before we discuss I/O in C, let's review how C++ I/O works. int i; double x; cin >> i; cin >> x; cout
More informationBULLETIN 1203-GD2, -GK2 & 1336-GM2 DF1 MESSAGING (FULL DUPLEX / POINT-TO-POINT)
BULLETIN 1203-GD2, -GK2 & 1336-GM2 DF1 MESSAGING (FULL DUPLEX / POINT-TO-POINT) APPLICATION NOTE OCTOBER 20, 1999 PURPOSE The purpose of this document is to provide information on using the DF1 Full Duplex/Point-to-Point
More informationCSI 402 Lecture 2 Working with Files (Text and Binary)
CSI 402 Lecture 2 Working with Files (Text and Binary) 1 / 30 AQuickReviewofStandardI/O Recall that #include allows use of printf and scanf functions Example: int i; scanf("%d", &i); printf("value
More informationCSCI-1680 Link Layer I Rodrigo Fonseca
CSCI-1680 Link Layer I Rodrigo Fonseca Based partly on lecture notes by David Mazières, Phil Levis, John Jannotti Last time Physical layer: encoding, modulation Today Link layer framing Getting frames
More informationStream Model of I/O. Basic I/O in C
Stream Model of I/O 1 A stream provides a connection between the process that initializes it and an object, such as a file, which may be viewed as a sequence of data. In the simplest view, a stream object
More informationLecture 7: file I/O, more Unix
CIS 330: / / / / (_) / / / / _/_/ / / / / / \/ / /_/ / `/ \/ / / / _/_// / / / / /_ / /_/ / / / / /> < / /_/ / / / / /_/ / / / /_/ / / / / / \ /_/ /_/_/_/ _ \,_/_/ /_/\,_/ \ /_/ \ //_/ /_/ Lecture 7: file
More informationLab Objectives. 2. Preparations. 3. Signing in. 4. Examining the Host Environment. 5. Part A: Introduction to AVR Studio. 5.
Lab 0 1. Objectives Learn how to use AVR studio, an Integrated Development Environment (IDE) for developing AVR applications in Windows environments, to debug and run an AVR assembly program. Understand
More informationIntroduction to Programming in C Department of Computer Science and Engineering. Lecture No. #28. Functions: Examples 2
Introduction to Programming in C Department of Computer Science and Engineering Lecture No. #28 Functions: Examples 2 (Refer Slide Time: 00:14) With the concepts we have seen so far, let us design a sample
More informationCS61C Machine Structures. Lecture 4 C Pointers and Arrays. 1/25/2006 John Wawrzynek. www-inst.eecs.berkeley.edu/~cs61c/
CS61C Machine Structures Lecture 4 C Pointers and Arrays 1/25/2006 John Wawrzynek (www.cs.berkeley.edu/~johnw) www-inst.eecs.berkeley.edu/~cs61c/ CS 61C L04 C Pointers (1) Common C Error There is a difference
More informationCreating a Shell or Command Interperter Program CSCI411 Lab
Creating a Shell or Command Interperter Program CSCI411 Lab Adapted from Linux Kernel Projects by Gary Nutt and Operating Systems by Tannenbaum Exercise Goal: You will learn how to write a LINUX shell
More information7/21/ FILE INPUT / OUTPUT. Dong-Chul Kim BioMeCIS UTA
7/21/2014 1 FILE INPUT / OUTPUT Dong-Chul Kim BioMeCIS CSE @ UTA What s a file? A named section of storage, usually on a disk In C, a file is a continuous sequence of bytes Examples for the demand of a
More informationECE15: Lab #4. Problem 1. University of California San Diego
University of California San Diego ECE15: Lab #4 This lab is a cumulative wrap-up assignment for the entire course. As such, it relates to the material covered in Lecture Units 1 5 and 7 9 in class. Here
More informationC Basics And Concepts Input And Output
C Basics And Concepts Input And Output Report Working group scientific computing Department of informatics Faculty of mathematics, informatics and natural sciences University of Hamburg Written by: Marcus
More informationSU 2017 May 11/16 LAB 2: Character and integer literals, number systems, character arrays manipulation, relational operator
SU 2017 May 11/16 LAB 2: Character and integer literals, number systems, character arrays manipulation, relational operator 0 Problem 0 number bases Visit the website www.cleavebooks.co.uk/scol/calnumba.htm
More informationC How to Program, 6/e by Pearson Education, Inc. All Rights Reserved.
C How to Program, 6/e 1992-2010 by Pearson Education, Inc. An important part of the solution to any problem is the presentation of the results. In this chapter, we discuss in depth the formatting features
More informationComputer Programming: Skills & Concepts (CP1) Files in C. 18th November, 2010
Computer Programming: Skills & Concepts (CP1) Files in C 18th November, 2010 CP1 26 slide 1 18th November, 2010 Today s lecture Character oriented I/O (revision) Files and streams Opening and closing files
More informationComparison of ISO-OSI and TCP/IP Suit. Functions of Data Link Layer:
Comparison of ISO-OSI and TCP/IP Suit Functions of Data Link Layer: 1. Frame generation ( Character Count, Character Stuffing, Bit Stuffing) 2. Error Processing (Parity(EVEN or ODD), Block Parity, Hamming
More informationCopyright The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Chapter 18 I/O in C Standard C Library I/O commands are not included as part of the C language. Instead, they are part of the Standard C Library. A collection of functions and macros that must be implemented
More informationCS240: Programming in C
CS240: Programming in C Lecture 13 si 14: Unix interface for working with files. Cristina Nita-Rotaru Lecture 13/Fall 2013 1 Working with Files (I/O) File system: specifies how the information is organized
More informationGoals of this Lecture
I/O Management 1 Goals of this Lecture Help you to learn about: The Unix stream concept Standard C I/O functions Unix system-level functions for I/O How the standard C I/O functions use the Unix system-level
More informationAdvantages and disadvantages
Advantages and disadvantages Advantages Disadvantages Asynchronous transmission Simple, doesn't require synchronization of both communication sides Cheap, timing is not as critical as for synchronous transmission,
More informationLecture 8: Structs & File I/O
....... \ \ \ / / / / \ \ \ \ / \ / \ \ \ V /,----' / ^ \ \.--..--. / ^ \ `--- ----` / ^ \. ` > < / /_\ \. ` / /_\ \ / /_\ \ `--' \ /. \ `----. / \ \ '--' '--' / \ / \ \ / \ / / \ \ (_ ) \ (_ ) / / \ \
More informationWeek 5 Lecture 3. Compiler Errors
Lecture 3 Compiler Errors Agile Development Backlog of stories defines projects Backlog contains all of the requirements currently known Stories define features of the project Three elements: feature user,
More informationI/O Management! Goals of this Lecture!
I/O Management! 1 Goals of this Lecture! Help you to learn about:" The Unix stream concept" Standard C I/O functions" Unix system-level functions for I/O" How the standard C I/O functions use the Unix
More informationCSE 410: Systems Programming
CSE 410: Systems Programming Input and Output Ethan Blanton Department of Computer Science and Engineering University at Buffalo I/O Kernel Services We have seen some text I/O using the C Standard Library.
More informationLESSON 4. The DATA TYPE char
LESSON 4 This lesson introduces some of the basic ideas involved in character processing. The lesson discusses how characters are stored and manipulated by the C language, how characters can be treated
More informationIntroduction to Computer Networks. 03 Data Link Layer Introduction
Introduction to Computer Networks 03 Data Link Layer Introduction Link Layer 1 Introduction and services 2 Link Layer Services 2.1 Framing 2.2 Error detection and correction 2.3 Flow Control 2.4 Multiple
More informationI/O Management! Goals of this Lecture!
I/O Management! 1 Goals of this Lecture! Help you to learn about:" The Unix stream concept" Standard C I/O functions" Unix system-level functions for I/O" How the standard C I/O functions use the Unix
More informationUsing printf with an AVR
Using printf with an AVR Based on : http://efundies.com/avr/avr_printf.htm Required Functions You should keep all of the functions that you need from the previous guide: usart_init() usart_getchar() usart_purchar()
More informationFor Your Amusement. Beware of bugs in the above code; I have only proved it correct, not tried it. Donald Knuth. Program Verification
Princeton University Computer Science 217: Introduction to Programming Systems Testing For Your Amusement On two occasions I have been asked [by members of Parliament!], Pray, Mr. Babbage, if you put into
More informationStandard C Library Functions
Demo lecture slides Although I will not usually give slides for demo lectures, the first two demo lectures involve practice with things which you should really know from G51PRG Since I covered much of
More information/* defines are mostly used to declare constants */ #define MAX_ITER 10 // max number of iterations
General Framework of a C program for MSP430 /* Compiler directives (includes & defines) come first */ // Code you write in this class will need this include #include msp430.h // CCS header for MSP430 family
More informationHello, World! in C. Johann Myrkraverk Oskarsson October 23, The Quintessential Example Program 1. I Printing Text 2. II The Main Function 3
Hello, World! in C Johann Myrkraverk Oskarsson October 23, 2018 Contents 1 The Quintessential Example Program 1 I Printing Text 2 II The Main Function 3 III The Header Files 4 IV Compiling and Running
More informationHomework 2 Answers. Due Date: Monday, April 29, 2002, at 11:59PM Points: 100
Homework 2 Answers Due Date: Monday, April 29, 2002, at 11:59PM Points: 100 UNIX System 1. (10 points) What program is running as process #1? Type ps ax and look for the process with a PID of 1. Then look
More informationToday CISC124. Building Modular Code. Designing Methods. Designing Methods, Cont. Designing Methods, Cont. Assignment 1 due this Friday, 7pm.
CISC124 Today Assignment 1 due this Friday, 7pm. QWIC Tutorial Tonight at 8pm in Mac-Corry D201. Building modular code at the method level. Start Numeric Representation. Fall 2018 CISC124 - Prof. McLeod
More informationCSci 4061 Introduction to Operating Systems. Input/Output: High-level
CSci 4061 Introduction to Operating Systems Input/Output: High-level I/O Topics First, cover high-level I/O Next, talk about low-level device I/O I/O not part of the C language! High-level I/O Hide device
More information8. Characters, Strings and Files
REGZ9280: Global Education Short Course - Engineering 8. Characters, Strings and Files Reading: Moffat, Chapter 7, 11 REGZ9280 14s2 8. Characters and Arrays 1 ASCII The ASCII table gives a correspondence
More informationCSE 303: Concepts and Tools for Software Development
CSE 303: Concepts and Tools for Software Development Hal Perkins Winter 2009 Lecture 7 Introduction to C: The C-Level of Abstraction CSE 303 Winter 2009, Lecture 7 1 Welcome to C Compared to Java, in rough
More informationCompSci 356: Computer Network Architectures. Lecture 4: Link layer: Encoding, Framing, and Error Detection Ref. Chap 2.2, 2.3,2.4
CompSci 356: Computer Network Architectures Lecture 4: Link layer: Encoding, Framing, and Error Detection Ref. Chap 2.2, 2.3,2.4 Xiaowei Yang xwy@cs.duke.edu Overview Review: link/network performance metrics
More informationFile I/O. Last updated 10/30/18
Last updated 10/30/18 Input/Output Streams Information flow between entities is done with streams Keyboard Text input stream data stdin Data Text output stream Monitor stdout stderr printf formats data
More informationLecture 12 CSE July Today we ll cover the things that you still don t know that you need to know in order to do the assignment.
Lecture 12 CSE 110 20 July 1992 Today we ll cover the things that you still don t know that you need to know in order to do the assignment. 1 The NULL Pointer For each pointer type, there is one special
More informationL3: Building Direct Link Networks I. Hui Chen, Ph.D. Dept. of Engineering & Computer Science Virginia State University Petersburg, VA 23806
L3: Building Direct Link Networks I Hui Chen, Ph.D. Dept. of Engineering & Computer Science Virginia State University Petersburg, VA 23806 8/22/2016 CSCI 445 Fall 2016 1 Acknowledgements Some pictures
More information5th Slide Set Computer Networks
Prof. Dr. Christian Baun 5th Slide Set Computer Networks Frankfurt University of Applied Sciences WS1718 1/38 5th Slide Set Computer Networks Prof. Dr. Christian Baun Frankfurt University of Applied Sciences
More informationSWEN-250 Personal SE. Introduction to C
SWEN-250 Personal SE Introduction to C A Bit of History Developed in the early to mid 70s Dennis Ritchie as a systems programming language. Adopted by Ken Thompson to write Unix on a the PDP-11. At the
More informationPROGRAMMAZIONE I A.A. 2017/2018
PROGRAMMAZIONE I A.A. 2017/2018 INPUT/OUTPUT INPUT AND OUTPUT Programs must be able to write data to files or to physical output devices such as displays or printers, and to read in data from files or
More informationCOMP2121 Introductory Experiment
COMP2121 Introductory Experiment Objectives: In this introductory experiment, you will: Learn how to use AVR studio, an Integrated Development Environment (IDE) for developing AVR applications in Windows
More informationCS 220: Introduction to Parallel Computing. Input/Output II. Lecture 8
CS 220: Introduction to Parallel Computing Input/Output II Lecture 8 Today s Agenda Debugging and I/O Buffering I/O Streams Writing files 2/7/18 CS 220: Parallel Computing 2 Today s Agenda Debugging and
More informationECE15: Lab #2. Problem 1. University of California San Diego
University of California San Diego ECE15: Lab #2 This lab relates to the material covered in Lecture Units 4 and 5 in class, and in Chapters 3 and 5 of the Kernighan and Ritchie textbook. Similar material
More informationMaria Hybinette, UGA. ! One easy way to communicate is to use files. ! File descriptors. 3 Maria Hybinette, UGA. ! Simple example: who sort
Two Communicating Processes Hello Gunnar CSCI 6730/ 4730 Operating Systems Process Chat Maria A Hi Nice to Hear from you Process Chat Gunnar B Dup & Concept that we want to implement 2 On the path to communication
More informationITC213: STRUCTURED PROGRAMMING. Bhaskar Shrestha National College of Computer Studies Tribhuvan University
ITC213: STRUCTURED PROGRAMMING Bhaskar Shrestha National College of Computer Studies Tribhuvan University Lecture 07: Data Input and Output Readings: Chapter 4 Input /Output Operations A program needs
More informationAdvanced Computer Networks. Rab Nawaz Jadoon DCS. Assistant Professor COMSATS University, Lahore Pakistan. Department of Computer Science
Advanced Computer Networks Rab Nawaz Jadoon Department of Computer Science DCS COMSATS Institute of Information Technology Assistant Professor COMSATS University, Lahore Pakistan Advanced Computer Networks
More information