Lecture note for 08/28
Example of a Network stanard: RS232
- Also called "serial line" or "tty line"
- It was used to connect terminals to computers. It is now used to
connect mouse and keyboard.
- Specifies by EIEA
- Standard fo the transmission of characters.
- It is called "serial" because characters are sent one after
another
- Communication is "asynchronous" because the transmitter and
reciever do nor coordinate before the transmission of a
character. (The receiver does not know when a character will arrive.)
- Voltage: +15V is zero, -15V is one. When line is idle, the level
is always -15V.
- A start bit (0) is used to tell the receiver that a character has
been sent
- Sender and receiver must agree on:
- Number of bits per character
- Duration of each bit (T). Typical speeds are 9.6Kbps, 14.4Kbps,
28.8kbps, 56.6kbps
Units,
- 1 byte = 8 bits
- 1 baud = 1 bit per second
- 1024 = 1k
- 1kBps = 1k bytes per secone
- 1kps = 1k bits per second
- If there is a disagreement in the format of the message, the
receiver gets a "framing error".
example
- one bit is missing,
- no start bit
- no stop bit
- Serial lines are usually "full duplex". That is, both ends can
transmit and recieve. In contrast, "half duplex" means one end
transmit and one end receives.
- Serial lines need at least three cables. (In order to be full
duplex.)
Problems with electrical transmission
- Serial lines are limited to about 50 ft
- The resistance of the cable decreases the signal as it travels.
- Capacitance and inductance of the cable distorts the signal.
- Magnetic and electrical interference also distorts the signal.
- RS232 deals with this problem by having a voltage threashold less
than 15 volts.
- Takes multiple samples
- Direct current, like the one used by RS232, cannot be used for
long distances.
- For long distance communications, it is necessary to encode the
signal in a sine wave (Also called "carier wave" )
- Some of the properties are changed (moduled) to encode the
information.
- This technique is also used in TV and radio
Characteristic of a sine wave
AM: Amplitude modulation
FM: Frequency modulation
PM: Phase modulation
Class note for 8/30
Lab: decode the ethernet and ip address
Using snoop: we can only sneak packets of the private network.
- Generate difference packets in private network, and capture
them. Save packets in a file.
- Write a program to decode the packets and write the header
information. The packets are stored in a file.
analyze filename
- Funtions to read packets are provided
While there are packets in a file {
read the packet,
if the packet is ARP, print ARP header
else if packet is IP, {
print IP header,
if TCP, print TCP header,
else if UDP, print UDP header,
else if ICMP, print ICMP header
}
}
How do you know if a packet is ARP or IP?
How do you know if a packet is TCP, UDP or ICMP?
Decode the packet: IP packet is in the ethernet packet data area.
How to place a packet header in data area?
char * buffer;
struct ehdr * e; /* this defines a structure that is ethernet header.
in ether.h:
struct ehdr{
unsigned char dst[6],
unsigned char src[6],
unsigned short type,
unsigned char data[1]
}
/*
e = (struct ehdr * ) buffer ;
/* you can access e->type (look it up in ether.h file
Assume that it is IP header, now decode ip header the same way, */
struct iphdr * ip;
ip= (struct iphdr *) e->data;
/* Bit order is different in some architecture. In packets,
the least significant bit comes first. So, use
ntohs() for short and ntohl() for long to convert short/longs from
network byte order to host byte order */
Types of modulation
Amplitude
Amplitude of signals encode 0 and 1.
Problem: it's hard to distinguish in a noisy environment.
Frequency modulation
Data is encoded in changes of frequency.
FM is more tolarant to noise.
Phase-shift modulation
Modems
- Hardware device used for long distance communication
- a Modem has a modulator and a demodulator

- modems are common for telephone lines, but other types of modem also exist
modem types
----------------
conventional ----- electrical signals for copper wires
optical ----- light, using optical fiber
wireless ----- air, radio frequency waves
dialup ----- telephone system, modulated audio tones
- other functions of a dial-up modem
Class notes for 9/1
Network parameters
- Propagation delay : time required for a signal to travel across the medium.
- Bandwidth : Maximum times per second that a signal can change
- Throughput : Number of bits per second that can be transmitted. Notice that throughput is related to the hardware bandwidth.
Relationship between bandwidth and Throughput
Nyquist Theorem
: relates network bandwidth and throughput
D = 2 B log(K)
where D: max throuput, B: bandwidth, K: Number of values that encodes data. log is base 2.
example: in RS232,
K = 2 (+15V/-15V)
D = 2 B log 2 = 2 B
So, the throuput in RS232 is 2 times the bandwidth.
example: Phase shift encoding
Assume K=4 (4 possible phase shifts )
D = 2 B log 4 = 4 B
Notice that Nyquist theorem does not consider noise. therefore, it only gives a maximum theoretical limit.
Shannon's Therom
C = B log (1+ (S/N) )
where C : throughtput (bits/sec)
B : bandwidth (hardware bandwidth )
S: power of signal ( in watts )
N : power of noise ( in watts )
log : based two
Notice that if noise is zero, throughput is infinity.
(S/N) is called "signal-to-noise ratio"
example: telephone system:
Bandwitdth : 3000Hz (anything over 3000Hz is lost. the highest we can hear is 20kHz)
S/N : signal to noise ratio
effective capacity (Throughput) C = B log (1 + (S/N)) = 30,000bps
with a S/N of 1000, there is little hope to complish more than 30kbps. 56kbps modems have this sped only with good quality phone lines with larger S/N ratio and also use compression.
S/N (signal to noise ratio) is usually given in decibels (dB).
S/N in decibels = 10*log(S/N) ***notice that this log is base 10 ***
example:
if S/N = 1000, then S/N in decibels = 10*3 = 30dB.
if S/N = 20dB, then S/N =100
Conclusion:
- Nyquist theorem implies that we could increase throughput by finding new ways to encode more bits per cycle.
- Shannon's theorem implies that no amount of clever encoding can overcome the limit of real transmission lines with noise.
Multiplexing
using a shared channel to transmit seperate sources of information.
multiplexing needs to prevent interference among signals.