0% found this document useful (0 votes)
9 views

Lecture 2

This document discusses network interfaces and layers. It describes how sockets provide a network-application interface that allows applications to communicate over the network by hiding network details. Traceroute allows peeking inside the network and provides a network-network interface. Network protocols are organized in layers, with each protocol instance communicating with its peer using that protocol. Common protocols discussed include TCP, IP, Ethernet, and HTTP.

Uploaded by

Ale Moreno
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Lecture 2

This document discusses network interfaces and layers. It describes how sockets provide a network-application interface that allows applications to communicate over the network by hiding network details. Traceroute allows peeking inside the network and provides a network-network interface. Network protocols are organized in layers, with each protocol instance communicating with its peer using that protocol. Common protocols discussed include TCP, IP, Ethernet, and HTTP.

Uploaded by

Ale Moreno
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

ECE534/634 Communication Networks

CSC424 Computer Networks

Network Interfaces, Layers

1
Previously …
• Network Components
– Apps, Nodes, Links

• History of the Internet


– ARPRNET
• Packet Switching
• Decentralized Control
• Internetworking
– NSFNET
– Modern Internet

2
Network

app

router link
host

3
Key Interfaces
1. Network-application interfaces define how apps use
the network
– Sockets are widely used in practice
– Lets apps talk to each other via hosts; hides the details of
the network

app

host

4
Motivating Application
• Simple client-server setup
– Client app sends a request to server app
– Server app returns a (longer) reply

• This is the basis for many apps!


– File transfer: send name, get file
– Web browsing: send URL, get page
– Echo: send message, get it back

• Let’s see how to write this app …


5
Socket API
• Simple abstraction to use the network
– The network service API used to write all Internet
applications
– Part of all major OSes and languages; originally
Berkeley (Unix) ~1983

• Supports two kinds of network services


– Streams: reliably send a stream of bytes
– Datagrams: unreliably send separate messages.
6
Socket API
• Sockets let apps attach to the local network at
different ports
Socket, Socket,
Port #1 Port #2

Primitive Meaning
SOCKET Create a new communication endpoint
BIND Associate a local address with a socket
LISTEN Announce willingness to accept connections; give queue size
ACCEPT Passively establish an incoming connection
CONNECT Actively attempt to establish a connection
SEND Send some data over the connection
RECEIVE Receive some data from the connection
CLOSE Release the connection 7
Using Sockets
Client (host 1) Time Server (host 2)
1: socket
1: socket 2: bind
connect 3: listen
4: accept*
5: connect*
request 6: recv*
7: send
8: recv* reply
9: send
disconnect
10: close 10: close *= call blocks

8
Server Program (stream)

9
Server Program (stream)

10
Server Program (stream)

11
Server Program (stream)

12
Client Program (stream)

13
Client Program (stream)

14
Client Program (stream)

15
Run Server/Client
• Commend line for server
– ./server.out 100
• Commend line for client
– ./client.out chenmingzhes-MacBook-Pro.local 100

16
Socket (Datagrams)
• Datagrams (UDP) are (a little) different
Create

Receive

Send

Connectionless

• Useful references
– http://www.linuxhowtos.org/C_C++/socket.htm
– https://www.cs.rutgers.edu/~pxk/417/notes/sockets/udp.
html
17
Key Interfaces
2. Network-network interfaces define how nodes work
together
– Traceroute can peek in the network

app

host

18
Traceroute
• Widely used command-line tool to let hosts peek
inside the network
– On all OSes (tracert on Windows)

• Probes successive hops to find network path

...
1 hop 2 hops 3 hops N-1 hops
N hops
Local Remote
Host Host 19
Using Traceroute

Traceroute sends out three packets per TTL increment. Each column corresponds to
the time took to get one packet back (RTT)

20
Protocols and Layers
• The network does much for apps
– Make and break connections
– Find a path through the network
– Transfers information reliably
– Transfers arbitrary length information
– Send as fast as the network allows
– Shares bandwidth among users
– Secures information in transit
– Let many new hosts be added
– …

• Need a form of modularity to help manage complexity and


support reuse

21
Protocols and Layers
• Protocols and layering is the main structuring method used to
divide up network functionality
– Each instance of a protocol talks virtually to its peer using the protocol
– Each instance of a protocol uses only the services of the lower layer

Instance of protocol X Peer instance


Protocol X
X X

Service provided by Protocol Y


Lower layer instance
(of protocol Y)
Y Y

Node 1 Node 2
22
Protocols and Layers
• A list of protocols in use is called a protocol stack

23
Protocols and Layers
• Protocols you’ve probably heard of
– TCP, IP, 802.11, Ethernet, HTTP, SSL, DNS, … and
many more
Browser

• An example protocol stack HTTP


– Used by a web browser on TCP
a host that is wirelessly IP
connected to the Internet 802.11

24

You might also like