/* TCP/IP Dissected */
/* Part -1 */
/* Coded by BlackMask */
/* Wed Oct 30 13:39:46 IST 2002 */

Introduction :-
Hi friends here is the first part of my tutorial on TCP/IP. Hope you will enjoy
it. Suggestions and comments are welcome. This part explains the basics of
data transmission/communication.

Data Transmission :-
Data communication is mainly concerned with the transmission of digital
information between two Data Terminal Equipments(DTE = communicating parties).
The DTE's must also exchange control messages besides data to ensure the
correctness od the data transmitted/received. Error correction is one of the
main things that is of primary concern while transferring data.
There are three types of communication modes -
o Simplex - In this data is transmitted in one direction only. This refers to
one way and is not used for interactive communication. This mode
is used in data logging systems.
o Half-Duplex - In this mode data can be transmitted in both directions but
only one at a time. The DTEs must be able to switch between
sender and receiver modes after each transmission. This too is
not so interactive and is used in places where data transfer
is needed only in response to a request from one party.
o Duplex - Also called full-duplex, data transmission can occur in both
directions simultaneously. Used in places where interactive data
transfer is needed. This is used in telephone networks.
Data is normally transmitted between two DTEs in multiples of fixed length
unit, usually 8-bits. If the file being transferred is a plain data file then
the data being transferred consists of binary-encoded characters and if its a
compiled object code then the data transferred will be made up of a block of
8-bit bytes(frame). This data is transferred over the medium in bit-serial
mode ,bit-by-bit.As we said earlier we also pass control characters along with
the message.This characters determine the start and stop of the message,frame
and the characters.Each bit transmitted consists of a start bit and a stop
bit.This is necessary for the receiving end in-order to decode the data being
received correctly. This is known as bit synchronization. The receiver has to
achieve bit synchronization, character synchronization and frame
synchronization to decode and interpret the data being received correctly.(all
these synchronizations are used to find the start and end of the corresponding
entities.).Two types of transmission modes used are
o Asynchronous transmission - This is main;y used in transmitting data between
the keyboard and the computer, but it is also
used to send blocks of characters between
computers.Here characters are transmitted one
after the other.Each has its own start and stop
bits for character synchronization. As blocks of
data are transmitted the receiver must be able
to understand the start and end of each
frame,which is known as character
synchronization.When transmitting blocks of plain
printable characters they are encapsulated
between special non-printable control characters
STX(start-of-text) and ETX(end-of-text).This is
easily interpreted by the receiver as the
original data consists only of printable
characters.In the case of compiled binaries this
is not sufficient as the data may contain the
same control characters, as a part, which are used
to mark the start and end.So here we use another
control character known as Data-Link Escape(DLE)
in front of the control characters to mark the
start and end.I see a doubt arising in your mind
now.Yes what if the DLE appears as a part of the
binaries.this is overcome by adding a DLE in
front of that.Whenever the receiver sees a DLE
it checks whether the next character is a DLE or
STX/ETX, if its a DLE then the receiver discards
it and when it is a ETX or STX the receiver can
reliably take it as the start or end of frame.
This is known as bit-stuffing.Now think why we
use 'ascii' and 'binary' commands on the ftp
prompt while using it to download something.This
is just a vague description of what is done
during transmission and interpret it as the
actual process.
o Synchronous transmission - due to the use of additional start and stop bits
in asynchronous mode its inefficient in its use
of transmission capacity.In synchronous mode no
start and stop bits are used, instead the block
of data is transmitted an a contiguous stream of
binary digits.Here also the receiver has to
achieve bit,character and frame
synchronization.I am not gonna explain it this
time as they are far more complex than the
earlier one.If you need more information o this
get some book on communication or search the
Error detection :-
As the data are transmitted through the transmission lines it is highly prone
to errors due to interference of electrical signals or due to noise.A slight
change in the signal can cause the data being received to be interpreted as
something else.So we employ mechanism for detecting errors and to correct
them.Two approaches used for this are
1) Forward error control in which the frame contains additional information so
that the receiver can detect the error and also determine where it is located.
2) Feedback error control - in this additional information tells the receiver
whether an error has occurred or not.On detecting an error the receiver
requests for another copy of the data.
One of the common ways for detecting bit-errors is by including a parity bit
to each transmitted character prior to transmission.The scheme uses either
even parity or odd parity.In even parity the number of one bits in the
character are added together and if its an odd value a one bit(parity) is
added to make the total one-bits even.If the value is even no parity bit is
added.So a change is easily detected by the receiver.But this does not detect
2-bit errors.In such cases we use polynomial codes.These are used with frame
transmission schemes.A single set of check digits is generated for each frame
transmitted.this is attached to the end of the frame.At the receiver side a
similar computation is made on the frame received.this is then compared with
the code attached with the frame.If there is a change, there is an error.The
check digits are usually 16 or 32 bits and are called Cyclic Redundancy Check
(CRC) digits.
Data Compression :-
Till now we assumed that the contents of transmitted frames consisted of the
original data in the form of strings of bytes.Although this is the case with
most of the data communication applications, there are others in which the
source data is compressed before being transmitted.This is done in public
switched data networks (PSDN).This is done to save transmission costs.These
compressions are done using data compression algorithms.Some of the modems now
offer an adaptive compression feature which selects compression algorithms to
suit the type of data being transmitted.One compression is method is by using
packed decimal.If the data being transmitted consists only numbers then we can
reduce the number of bits per character from seven to four by using BCD(Binary
coded decimal) instead of ASCII.For example the 10 numeric digits (0-9) all
have a 011 in their higher-order bit positions.So this need not be transmitted
if the data consists of only numbers.Another method is relative encoding in
which if the successive values in numeric data only differ by a small amount,
only the magnitude difference and a reference value is transmitted.Another
popular method is Huffman encoding.It exploits the that not all symbols in a
transmitted frame occur with the same frequency.An entirely different encoding
is used here.The more common characters are encoded using fewer bits than less
frequent characters.

Conclusion :-
Hope you got some idea about communication.I know that this got a bit long but i
couldn't help it.