Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 K. Salah Application Layer Module 2.0. 2 K. Salah Network layer duties.

Similar presentations


Presentation on theme: "1 K. Salah Application Layer Module 2.0. 2 K. Salah Network layer duties."— Presentation transcript:

1 1 K. Salah Application Layer Module 2.0

2 2 K. Salah Network layer duties

3 3 K. Salah Client-Server Model: Socket Interface

4 4 K. Salah Most common way by which a computer can ask for the services of another computer. Internet is based on C/S model When should an application program be running – all the time or just when there is a need for the service? Client program, which requests a service, should run only when it is needed. Server program, which provides a service, should run all the time because it does not know when its services will be needed.

5 5 K. Salah Concurrency Concurrency in Clients Clients can be run on a machine either iteratively or concurrently. Running iteratively: means running them one by one; one client must start, run, and terminate before the machine can start another client. Concurrent clients: Two or more clients can run at the same time. Concurrency in Servers Iterative server: Can process only one request at a time; it receives a request, processes it, and sends the response to the requestor before it handles another request. Concurrent server: Can process many requests at a time; share its time between many requests.

6 6 K. Salah Client-Server Model Client-Server Relationship

7 7 K. Salah Figure 24.3 Connectionless iterative server Uses connectionless protocol: UDP. Server processes one request at a time. Server uses one single port [well-known port]

8 8 K. Salah Figure 24.4 Connection-oriented concurrent server Uses connection-oriented: TCP Connection-oriented: request is a stream of bytes that can arrive in several segments and the response can occupy several segments. At first connection is established. Uses one well-known port and many ephemeral ports Server issues passive-open at well-known port. Client initially approaches this port. After connection is made, server assigns a temporary port to free the well-known port. Data transfer via ephemeral port.

9 9 K. Salah Processes Process is a program in execution. When the operating system executes a program, the program becomes a live, i.e. becomes a process. Several processes or threads can run simultaneously

10 10 K. Salah Figure 24.5 Socket structure Socket Interface Sockets Communication structure that we need in socket programming. Socket acts as an endpoint. Two processes need a socket at each end to communicate with each other. Family: Protocol group [IPv6, IPv4, UNIX domain protocols,…] Type: Type of socket [Stream, packet or raw socket] Protocol: set to zero for TCP and UDP. Local socket address: Local IP and port address Remote socket address: Remote IP and port address

11 11 K. Salah Figure 24.6 Socket types Stream socket: Connection-oriented protocol [TCP]; uses a pair of stream sockets to connect one application program to another across the Internet. Datagram socket: Connectionless protocol [UDP]; Uses a pair of datagram sockets. Raw socket: For ICMP or OSPF that directly use the services of IP.

12 12 K. Salah Connectionless Iterative Server Server duties: Create a socket Bind: Asks OS to enter information in the socket related to the server. Repeat Receive a request Process Send Client duties: Create a socket. No need for binding as OS normally fills in the information in the socket. Repeat Send Receive Destroy

13 13 K. Salah Figure 24.7 Socket interface for connectionless iterative server

14 14 K. Salah Connection-oriented Concurrent Server One buffer is each connection. Segments from clients are stored in appropriate buffers and handled concurrently by the server. Server duties: Create a socket Bind: Asks OS to enter information in the socket related to the server. Listen: Asks OS to passive and listen to the client. Repeat Create a child process Create a new socket Repeating: Read [byte-oriented], Process, Write Destroy the temporary socket Client duties: Create a socket. Connect. Repeat: Write, Read Destroy

15 15 K. Salah Figure 24.8 Socket interface for connection-oriented concurrent server


Download ppt "1 K. Salah Application Layer Module 2.0. 2 K. Salah Network layer duties."

Similar presentations


Ads by Google