Chapter 2 Applications and Layered Architectures Sockets.

Slides:



Advertisements
Similar presentations
Computer Net Lab/Praktikum Datenverarbeitung 2 1 Overview Sockets Sockets in C Sockets in Delphi.
Advertisements

Umut Girit  One of the core members of the Internet Protocol Suite, the set of network protocols used for the Internet. With UDP, computer.
CCNA – Network Fundamentals
Intermediate TCP/IP TCP Operation.
© Janice Regan, CMPT 128, CMPT 371 Data Communications and Networking Socket Programming 0.
UDP & TCP Where would we be without them!. UDP User Datagram Protocol.
© 2007 Cisco Systems, Inc. All rights reserved.Cisco Public 1 Version 4.0 OSI Transport Layer Network Fundamentals – Chapter 4.
Networks: TCP/IP Socket Calls1 Elementary TCP Sockets Chapter 4 UNIX Network Programming Vol. 1, Second Ed. Stevens.
Elementary TCP Sockets Chapter 4 UNIX Network Programming Vol. 1, Second Ed. Stevens.
Generic Transport Service Primitives Listen –notify Transport layer a call is expected Connect –establish Transport layer connection Send (or Write) Receive.
Socket Programming.
CSE 461: Transport Layer Connections. Naming Processes/Services  Process here is an abstract term for your Web browser (HTTP), servers (SMTP),
1 Generic Transport Service Primitives Listen –notify Transport layer a call is expected Connect –establish Transport layer connection Send (or Write)
Java Socket Support Presentation by: Lijun Yuan Course Number: cs616.
CS3771 Today: network programming with sockets  Previous class: network structures, protocols  Next: network programming Sockets (low-level API) TODAY!
CSE/EE 461 Getting Started with Networking. Basic Concepts  A PROCESS is an executing program somewhere.  Eg, “./a.out”  A MESSAGE contains information.
McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Application Layer PART VI.
1 School of Computing Science Simon Fraser University CMPT 771/471: Internet Architecture and Protocols Socket Programming Instructor: Dr. Mohamed Hefeeda.
I NTRODUCTION OF S OCKET P ROGRAMMING L.Aseel AlTurki King Saud University.
Gursharan Singh Tatla Transport Layer 16-May
Process-to-Process Delivery:
Sockets CIS 370 Fall 2009, UMassD. Introduction  Sockets provide a simple programming interface which is consistent for processes on the same machine.
TRANSPORT LAYER T.Najah Al-Subaie Kingdom of Saudi Arabia Prince Norah bint Abdul Rahman University College of Computer Since and Information System NET331.
1 Transport Layer Computer Networks. 2 Where are we?
Elementary TCP Sockets
Socket Programming. Introduction Sockets are a protocol independent method of creating a connection between processes. Sockets can be either – Connection.
Chapter 17 Networking Dave Bremer Otago Polytechnic, N.Z. ©2008, Prentice Hall Operating Systems: Internals and Design Principles, 6/E William Stallings.
9/12/2015B.R1 Socket Abstraction and Interprocess Communication B.Ramamurthy CSE421.
IP and Errors IP Best Effort Datagrams can be: –Lost –Delayed –Duplicated –Delivered out of order –Corrupted.
 Socket  The combination of an IP address and a port number. (RFC 793 original TCP specification)  The name of the Berkeley-derived application programming.
6.1. Transport Control Protocol (TCP) It is the most widely used transport protocol in the world. Provides reliable end to end connection between two hosts.
Transport Layer Layer #4 (OSI-RM). Transport Layer Main function of OSI Transport layer: Accept data from the Application layer and prepare it for addressing.
Section 5: The Transport Layer. 5.2 CS Computer Networks John Mc Donald, Dept. of Computer Science, NUI Maynooth. Introduction In the previous section.
ICOM 6115©Manuel Rodriguez-Martinez ICOM 6115 – Computer Networks and the WWW Manuel Rodriguez-Martinez, Ph.D. Lecture 26.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 2.5 Internetworking Chapter 25 (Transport Protocols, UDP and TCP, Protocol Port Numbers)
Dr. John P. Abraham Professor University of Texas Pan American Internet Applications and Network Programming.
The Socket Interface Chapter 21. Application Program Interface (API) Interface used between application programs and TCP/IP protocols Interface used between.
The Socket Interface Chapter 22. Introduction This chapter reviews one example of an Application Program Interface (API) which is the interface between.
CPSC 441 TUTORIAL – FEB 13, 2012 TA: RUITNG ZHOU UDP REVIEW.
Interfaces and Services Each layer provides a service to the layer above it. A service is a set of primitive operations. Under UNIX, primitives are implemented.
CSE/EE 461 Getting Started with Networking. 2 Basic Concepts A PROCESS is an executing program somewhere. –Eg, “./a.out” A MESSAGE contains information.
Chapter 27 Socket API Interface The interface between an application program and the communication protocols in an operating system is known as the Application.
Socket Programming Introduction. Socket Definition A network socket is one endpoint in a two-way communication flow between two programs running over.
Chapter 2 Applications and Layered Architectures Sockets.
The Client-Server Model And the Socket API. Client-Server (1) The datagram service does not require cooperation between the peer applications but such.
Socket Programming.
Advanced UNIX programming Fall 2002, lecture 16 Instructor: Ashok Srinivasan Acknowledgements: The syllabus and power point presentations are modified.
Berkeley Socket Abstraction
CSCI 330 UNIX and Network Programming Unit XIV: User Datagram Protocol.
UNIX Sockets Outline UNIX sockets CS 640.
Inter-Process Communication 9.1 Unix Sockets You may regard a socket as being a communication endpoint. –For two processes to communicate, both must create.
©The McGraw-Hill Companies, Inc., 2000© Adapted for use at JMU by Mohamed Aboutabl, 2003Mohamed Aboutabl1 1 Chapter 16 Socket Interface.
1 Dimension of Server Designs r Iterative vs Concurrent r Connection-oriented vs. connectionless r Stateful and stateless m Constrained by application.
Socket programming in C. Socket programming Socket API introduced in BSD4.1 UNIX, 1981 explicitly created, used, released by apps client/server paradigm.
McGraw-Hill Chapter 23 Process-to-Process Delivery: UDP, TCP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
1 K. Salah Application Layer Module K. Salah Network layer duties.
Two Transport Protocols Available Transmission Control Protocol (TCP) User Datagram Protocol (UDP) Provides unreliable transfer Requires minimal – Overhead.
SOCKET PROGRAMMING Presented By : Divya Sharma.
Transport Layer.
Socket Interface 1 Introduction 11 Socket address formats 2 API 12 13
CHAPTER 8 ELEMENTARY UDP SOCKETS
Transport layer API: Socket Programming
Process-to-Process Delivery:
Berkeley API Socket Programming
Berkeley API Socket Programming
CSC Advanced Unix Programming, Fall 2015
Berkeley API Socket Programming
Process-to-Process Delivery: UDP, TCP
Transport Layer 9/22/2019.
Presentation transcript:

Chapter 2 Applications and Layered Architectures Sockets

Socket API API (Application Programming Interface) Provides a standard set of functions that can be called by applications Berkeley UNIX Sockets API Abstraction for applications to send & receive data Applications create sockets that “plug into” network Applications write/read to/from sockets Hides details of underlying protocols & mechanisms Also in Windows, Linux, and other OS’s

Communications through Socket Interface ClientServer descriptor port number descriptor port number Application references a socket through a descriptor Socket bound to a port number Application 1 Socket Socket interface User Kernel Application 2 User Kernel Underlying communication protocols Communications network Socket Socket interface

Stream mode of service Connection-oriented First, setup connection between two peer application processes Then, reliable bidirectional in-sequence transfer of byte stream (boundaries not preserved in transfer) Multiple write/read between peer processes Finally, connection release Uses TCP Connectionless Immediate transfer of one block of information (boundaries preserved) No setup overhead & delay Destination address with each block Send/receive to/from multiple peer processes Best-effort service only Possible out-of-order Possible loss Uses UDP

Client & Server Differences Server Specifies well-known port # when creating socket May have multiple IP addresses (net interfaces) Waits passively for client requests Client Assigned ephemeral port # Initiates communications with server Needs to know server’s IP address & port # DNS for URL & server well-known port # Server learns client’s address & port #

Socket Calls for Connection- Oriented Mode socket() bind() read() close() Data Server Client listen() accept() Blocks write() connect() Connect negotiation write() read() Server does Passive Open socket creates socket to listen for connection requests Server specifies type: TCP (stream) socket call returns: non-negative integer descriptor; or -1 if unsuccessful close()

Socket Calls for Connection- Oriented Mode socket() bind() read() close() Data Server Client listen() accept() Blocks write() connect() Connect negotiation write() read() Server does Passive Open bind assigns local address & port # to socket with specified descriptor Can wildcard IP address for multiple net interfaces bind call returns: 0 (success); or -1 (failure) Failure if port # already in use or if reuse option not set close()

Socket Calls for Connection- Oriented Mode socket() bind() read() close() Data Server Client listen() accept() Blocks write() connect() Connect negotiation write() read() Server does Passive Open listen indicates to TCP readiness to receive connection requests for socket with given descriptor Parameter specifies max number of requests that may be queued while waiting for server to accept them listen call returns: 0 (success); or -1 (failure) close()

Socket Calls for Connection- Oriented Mode socket() bind() read() close() Data Server Client listen() accept() Blocks write() connect() Connect negotiation write() read() Server does Passive Open Server calls accept to accept incoming requests close()

Socket Calls for Connection- Oriented Mode socket() bind() read() close() Data Server Client listen() accept() Blocks write() connect() Connect negotiation write() read() close() Client does Active Open socket creates socket to connect to server Client specifies type: TCP (stream) socket call returns: non-negative integer descriptor; or -1 if unsuccessful

Socket Calls for Connection- Oriented Mode socket() bind() read() close() Data Server Client listen() accept() Blocks write() connect() Connect negotiation write() read() close() Client does Active Open connect establishes a connection on the local socket with the specified descriptor to the specified remote address and port # connect returns 0 if successful; -1 if unsuccessful Note: connect initiates TCP three-way handshake

Socket Calls for Connection- Oriented Mode socket() bind() read() close() Data Server Client listen() accept() Blocks write() connect() Connect negotiation write() read() accept wakes with incoming connection request accept fills client address & port # into address structure accept call returns: descriptor of new connection socket (success); or -1 (failure) Client & server use new socket for data transfer Original socket continues to listen for new requests close()

Socket Calls for Connection- Oriented Mode socket() bind() read() close() Data Server Client listen() accept() Blocks write() connect() Connect negotiation write() read() Data Transfer Client or server call write to transmit data into a connected socket write specifies: socket descriptor; pointer to a buffer; amount of data; flags to control transmission behavior write call returns: # bytes transferred (success); or -1 (failure); blocks until all data transferred close()

Socket Calls for Connection- Oriented Mode socket() bind() read() close() Data Server Client listen() accept() Blocks write() connect() Connect negotiation write() read() Data Transfer Client or server call read to receive data from a connected socket read specifies: socket descriptor; pointer to a buffer; amount of data read call returns: # bytes read (success); or -1 (failure); blocks if no data arrives close() Note: write and read can be called multiple times to transfer byte streams in both directions

Socket Calls for Connection- Oriented Mode socket() bind() read() close() Data Server Client listen() accept() Blocks write() connect() Connect negotiation write() read() Connection Termination Client or server call close when socket is no longer needed close specifies the socket descriptor close call returns: 0 (success); or -1 (failure) Note: close initiates TCP graceful close sequence close()

socket() Socket Calls for Connection-Less Mode sendto() socket() recvfrom() Data Server Client bind() Blocks until server receives data from client recvfrom() close() Data sendto() Server started socket creates socket of type UDP (datagram) socket call returns: descriptor; or -1 if unsuccessful bind assigns local address & port # to socket with specified descriptor; Can wildcard IP address

socket() Socket Calls for Connection-Less Mode sendto() socket() recvfrom() Data Server Client bind() Blocks until server receives data from client recvfrom() close() Data sendto() recvfrom copies bytes received in specified socket into a specified location recvfrom blocks until data arrives

sendto() socket() Socket Calls for Connection-Less Mode sendto() socket() recvfrom() Data Server Client bind() Blocks until server receives data from client recvfrom() close() Data Client started socket creates socket of type UDP (datagram) socket call returns: descriptor; or -1 if unsuccessful

sendto() socket() Socket Calls for Connection-Less Mode sendto() socket() recvfrom() Data Server Client bind() Blocks until server receives data from client recvfrom() close() Data Client started sendto transfer bytes in buffer to specified socket sendto specifies: socket descriptor; pointer to a buffer; amount of data; flags to control transmission behavior; destination address & port #; length of destination address structure sendto returns: # bytes sent; or -1 if unsuccessful

socket() Socket Calls for Connection-Less Mode sendto() socket() recvfrom() Data Server Client bind() Blocks until server receives data from client recvfrom() close() Data sendto() recvfrom wakes when data arrives recvfrom specifies: socket descriptor; pointer to a buffer to put data; max # bytes to put in buffer; control flags; copies: sender address & port #; length of sender address structure recvfrom returns # bytes received or -1 (failure) Note: receivefrom returns data from at most one send, i.e. from one datagram

socket() Socket Calls for Connection-Less Mode sendto() socket() recvfrom() Data Server Client bind() Blocks until server receives data from client recvfrom() close() Data sendto() Socket Close Client or server call close when socket is no longer needed close specifies the socket descriptor close call returns: 0 (success); or -1 (failure)