review: – why layer architecture? – peer entities – protocol and service interface –...

12
• Review: – Why layer architecture? – peer entities – Protocol and service interface Connection-oriented/connectionless service – Reliable/unreliable service – What type of service will a typical end user want? • Why even considering other types of services – layers in the TCP/IP reference model

Upload: katherine-bryant

Post on 17-Jan-2018

217 views

Category:

Documents


0 download

DESCRIPTION

Some network apps Web Instant messaging Remote login P2P file sharing Multi-user network games Streaming stored video clips Internet telephone Real-time video conference Massive parallel computing

TRANSCRIPT

Page 1: Review: – Why layer architecture? – peer entities – Protocol and service interface – Connection-oriented/connectionless service – Reliable/unreliable service

• Review:– Why layer architecture?– peer entities– Protocol and service interface– Connection-oriented/connectionless service– Reliable/unreliable service– What type of service will a typical end user want?

• Why even considering other types of services– layers in the TCP/IP reference model– layers in the ISO/OSI reference model

Page 2: Review: – Why layer architecture? – peer entities – Protocol and service interface – Connection-oriented/connectionless service – Reliable/unreliable service

Application Layer

• Problems to be addressed in this layer:– Directly related to the individual application (no common

problems)• Design issues

– directly related to each application (no common issues).

• Introduce application layer concepts.• Examine the service interface between the application layer

and the transport layer (socket API)• Give an example showing how to develop network

applications.

Page 3: Review: – Why layer architecture? – peer entities – Protocol and service interface – Connection-oriented/connectionless service – Reliable/unreliable service

Some network apps

• E-mail• Web• Instant messaging• Remote login• P2P file sharing• Multi-user network

games• Streaming stored

video clips

• Internet telephone• Real-time video

conference• Massive parallel

computing

Page 4: Review: – Why layer architecture? – peer entities – Protocol and service interface – Connection-oriented/connectionless service – Reliable/unreliable service

Network applications– run on different end

systems (not routers)– communicate over a

network.– view the network as the

abstraction provided by the network (the transport layer).

• Addressing end points• End-to end communication

application

transportnetworkdata linkphysical

application

transportnetworkdata linkphysical

application

transportnetworkdata linkphysical

Page 5: Review: – Why layer architecture? – peer entities – Protocol and service interface – Connection-oriented/connectionless service – Reliable/unreliable service

• Service provided by the network:– Objective: to allow processes on different machines to

talk to each other.• Is IP address alone sufficient to address an application entity?

– Network end points:• IP address + port number

– Why not IP address + PID?• A process can be associated with an end point.

– E.g: http -- 80, ssh – 22, telnet—23, DNS – 53

– Service provided by the network: end-to-end communications:

• Reliable connection-oriented byte stream service (TCP)• Unreliable connectionless service (UDP)

Page 6: Review: – Why layer architecture? – peer entities – Protocol and service interface – Connection-oriented/connectionless service – Reliable/unreliable service

– From a network application point of view, what is the logical topology of the network?

• A process can bind to an end point and talk to anyone else in the network.

Page 7: Review: – Why layer architecture? – peer entities – Protocol and service interface – Connection-oriented/connectionless service – Reliable/unreliable service

• TCP API:– How to access the end point from a process:

– socket: create a new communication end point

#include <sys/socket.h> int socket(int domain, int type, int protocol); domain: AF_UNIX file system AF_INET internet address type: SOCK_STREAM reliable connect-oriented, byte

stream SOCK_DGRAM unreliable connectionless SOCK_SEQPACKET record stream protocol: 0, non-zero for a specific protocol

– bind: attach an address to a socket

int bind(int socket, const struct sockaddr *address, size_t address_len)

address: contains the port number, address.sin_port

Page 8: Review: – Why layer architecture? – peer entities – Protocol and service interface – Connection-oriented/connectionless service – Reliable/unreliable service

• Service primitives for TCP:– listen: announce willingness to accept connections

int listen(int socket, int backlog); backlog: number of outstanding connections in the listen queue

– accpet: accept a new connection on a socket int accept (int socket, struct sockaddr *address, size_t *address_len); address: the address of the connecting socket

– connect: try to establish a connection int connect(int socket, const struct sockaddr *address, size_t

address_len); address: the destination address

– write: send data ssize_t write(int fildes, const void *buf, size_t nbyte);

– read: receive data ssize_t read(int fildes, void *buf, size_t nbyte);

– close: close a connection int close(int fildes);

Page 9: Review: – Why layer architecture? – peer entities – Protocol and service interface – Connection-oriented/connectionless service – Reliable/unreliable service

Server:

socket bind listen accept read/write close

Client:

socket connect read/write close

What is the end point (IP + port number) for the server?What is the end point (IP + port number) for the client?When is the TCP connection established?

Page 10: Review: – Why layer architecture? – peer entities – Protocol and service interface – Connection-oriented/connectionless service – Reliable/unreliable service

• One more problem: machines may represent numbers in different ways.

– See example3.c on linprog and program.

– use htons/htonl/ntohl/ntohs routines to solve the problem.

• See example1.c and example2.c.

Page 11: Review: – Why layer architecture? – peer entities – Protocol and service interface – Connection-oriented/connectionless service – Reliable/unreliable service

• TCP:– Reliable byte stream service.

• UDP:– Unreliable datagram service.

• Data may get lost – application may need to deal with more details in the communication.

Page 12: Review: – Why layer architecture? – peer entities – Protocol and service interface – Connection-oriented/connectionless service – Reliable/unreliable service

• Basic UDP service interface:– Socket, bind, sendto, recvfrom, close

UDP server UDP client

socket socketbind sendtorecvfrom recvfromsendto close

TCP server TCP client

socket socketBind connectListenAccept read/write closeRead/write close