24
Computer Networks COSC 6377 Lecture 2 Fall 2011 August 24, 2011

Computer Networks COSC 6377gnawali/courses/cosc6377-f11/cosc6377-f... · 2018-06-18 · Computer Networks COSC 6377 Lecture 2 Fall 2011 August 24, 2011. Announcements ... Lookahead

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Computer NetworksCOSC 6377

Lecture 2

Fall 2011

August 24, 2011

Announcements

• We will use Moodle instead of Blackboard

• You can bring one sheet of notes to the exams

Lookahead to HWs

• Iperf

• Wireshark

• SVN

• Socket programming

• Linux

• C

Data Communication

• How to communicate information?

– How to transmit?

– How to receive?

• Encoding / Decoding

Encode Decode

Information Information

EncodedSignal

Encoding Algorithms

• Choice based on many factors

– Medium

– Hardware and software available

– Error detection and correction desired

– Data

Clocking the Signal

Clock

Data

Encoded Signal

• Syncing the transmitter and the receiver

Clock

Data

Encoded Signal

Unipolar Encoding

• Logic values represented high and low voltage

– 1 => + V

– 0 => 0 V

• Not self clocking

• DC component

http://en.wikipedia.org/wiki/Unipolar_encoding

Clock

Data

Encoded Signal

Bi-polar Encoding

Clock

Data

Encoded Signal• Code

– 1 => alternate +V and –V

– 0 => 0 V

• Can still lose clock synchronization

• Less DC component

http://en.wikipedia.org/wiki/Bipolar_encoding

Manchester Code

• Code

– 0 => L->H

– 1 => H->L

• Self Clocking

• No DC

• Efficiency

– Bit rate = ½ Baud rate

http://en.wikipedia.org/wiki/Manchester_code

Clock

Data

Encoded Signal

Sending Messages

• Messages: sequence of bits, bytes, packets, etc.

• Framing

– Packaging a collection of bits for communication

• Challenge

– Identify the start and end of a message

• Need a special marker or mechanism

Bit-based Framing

• A message is a sequence of bits

• Mark the beginning of a frame with a special sequence of bits

• Escape the marker sequence if it appears in the data (bit stuffing)

Read “Zero-bit insertion”– http://en.wikipedia.org/wiki/Bit_stuffing

Transmitting a Bit Stream

• Flag: 01110

• Data: 000111001101110

• TX:

• RX:

• A more realistic protocol (HDLC):– http://en.wikipedia.org/wiki/High-Level_Data_Link_Control

Byte-based Framing

• A message is a sequence of bytes

• Special bytes for SYN, START and END

• END might appear in the data stream– Need to Escape (character stuffing)

• Example– http://en.wikipedia.org/wiki/Binary_Synchronous_Communications

Transmitting a Byte Stream

• SYN = 12, START = 15, END = 7, ESC = 14

• Data: 1, 2, 15, 3, 2, 8

• TX:

• RX:

A More Common Framing Example

• Ethernet Frame

– Preamble

– Start Frame Delimiter

– Header

– Payload

– CRC

• Infer End using the “length” field in the header

• More details:

– http://en.wikipedia.org/wiki/Ethernet_frame

Detecting Errors

• Transmitted bits can flip

– Noise makes it hard to infer the signal

• Many sources of noise

• Send additional information along with the data to help the receiver detect errors

• Receiver can detect if a bit has flipped

Error Detection Codes

• Parity Bits– Add a bit to ensure the number of “1” bits is odd or

even

• Checksum– Add “sum” of the bits to the data

• CRC

• http://en.wikipedia.org/wiki/Parity_bit

• http://en.wikipedia.org/wiki/Checksum

Error Correction

• Forward Error Correction– Send redundant information

– Multi-dimensional parity, Hamming Code

• Retransmissions (ARQ)– Resend the data that had error

– Need additional control mechanisms

http://en.wikipedia.org/wiki/Error_detection_and_correction

Repetition Code

• Repeat the data you need to send

• Data: 101

• TX:

• RX:

• Too much overheadhttp://en.wikipedia.org/wiki/Repetition_code

Stop and Wait ARQ

Frame

ACK

Wait Time

TX RX

Retransmissions

Frame

ACK

Wait Time

Limitations of Stop-and-Wait

• Inefficient use of capacity

• Need to wait for one round trip before each packet

• Solution: Sliding window

http://en.wikipedia.org/wiki/Stop-and-wait_ARQ

Sliding Window Protocol

• TX is allowed to send W frames

• Put seq in the frame

• Ack returns the seq

• More efficient use of the link

Frame

Wait Time

Error Detection Code Properties

• As small as possible

• Locate the errors

• Problems

– False positive

– False negative

• Is 2D parity better than 1D parity?

– What are the tradeoffs?