Transcript lecture_1

Computer Networks and Internets
1
Internet Growth
2
What a Network Include
• Transmission hardware
• Special-purpose hardware device
– Interconnect transmission media
– Control transmission
– Run protocol software
• Protocol software
– Encodes and format data
– Detects and corrects problems
3
What a Network Does
• Provide communication that is
–
–
–
–
–
Reliable
Fair
Efficient
Secure
From one application to another
4
What a Network Does – Con’t
• Automatically detect and corrects
–
–
–
–
Data corruption
Data loss
Duplication
Out-of-order delivery
• Automatically finds optimal path from source
to destination
5
Ping program
6
Ping Program – Con’t
7
Traceroute Program
8
Network Programming
• Network allows arbitrary applications to
communicate
• Programmer does not need to understand
network technologies
• Network facilities accessed through an
Application Program Interface
9
Basic Paradigm for Internet
Communication
• Establish contact
• Exchange data (bi-directional)
• Terminate contact
10
Establishing Contact
• Performed by pair of applications
• One application starts and wait for contact
(called server)
• Other applications initiate contact (called
client)
11
Representations and Translations
• Humans use names such as:
– www.netbook.cs.purdue.edu (computer)
– ftp (applications)
• Network protocols require binary values
• Library routines exist to translate from names
to numbers
12
Example API
13
Illustration of API Calls
14
Definition of the API
•
•
•
•
•
connection await_contact (appnum a)
connection make_contact (computer c, appnum a)
appnum appname_toappnum(char* a)
computer cname_to_comp(char* a)
int send(connection con, char* buffer, int length, int
flags)
• int recv(connection con, char* buffer, int length, int
flags)
• int recvln(connection con, char* buffer, int length)
• int send_eof(connection con)
15
Summary of Example API
16
Illustration of Echo Application
17
Examples
• echoserver.c and echoclient.c
• chatserver.c and chatclient.c
• webclient.c and webserver.c
18
Summary
• Studying networks is important because
– The world is interconnected
– Applications now operate in a distributed
environment
19