Presentation Services  need for a presentation services  ASN.1  declaring data type  encoding data types  implementation issues  reading: Tannenbaum.

Slides:



Advertisements
Similar presentations
Umut Girit  One of the core members of the Internet Protocol Suite, the set of network protocols used for the Internet. With UDP, computer.
Advertisements

CCNA – Network Fundamentals
Tam Vu Remote Procedure Call CISC 879 – Spring 03 Tam Vu March 06, 03.
Remote Procedure CallCS-4513, D-Term Remote Procedure Call CS-4513 Distributed Computing Systems (Slides include materials from Operating System.
2: Application Layer 1 Socket programming Socket API r introduced in BSD4.1 UNIX, 1981 r explicitly created, used, released by apps r client/server paradigm.
Socket Programming.
CSCE 515: Computer Network Programming Chin-Tser Huang University of South Carolina.
CS490T Advanced Tablet Platform Applications Network Programming Evolution.
CS3771 Today: network programming with sockets  Previous class: network structures, protocols  Next: network programming Sockets (low-level API) TODAY!
1 © 2003, Cisco Systems, Inc. All rights reserved. CCNA 1 v3.0 Module 11 TCP/IP Transport and Application Layers.
Networks 1 CS502 Spring 2006 Network Input & Output CS-502 Operating Systems Spring 2006.
1 School of Computing Science Simon Fraser University CMPT 771/471: Internet Architecture and Protocols Socket Programming Instructor: Dr. Mohamed Hefeeda.
CS-3013 & CS-502, Summer 2006 Network Input & Output1 CS-3013 & CS-502, Summer 2006.
What Is TCP/IP? The large collection of networking protocols and services called TCP/IP denotes far more than the combination of the two key protocols.
I NTRODUCTION OF S OCKET P ROGRAMMING L.Aseel AlTurki King Saud University.
Gursharan Singh Tatla Transport Layer 16-May
Process-to-Process Delivery:
1 Chapter Internetworking Part 4 (Transport Protocols, UDP and TCP, Protocol Port Numbers)
1 Transport Layer Computer Networks. 2 Where are we?
Building an ftp client and server using sockets we now know enough to build a sophisticated client/server application!  ftp  telnet  smtp  http.
Chapter 17 Networking Dave Bremer Otago Polytechnic, N.Z. ©2008, Prentice Hall Operating Systems: Internals and Design Principles, 6/E William Stallings.
1 Chapter Client-Server Interaction. 2 Functionality  Transport layer and layers below  Basic communication  Reliability  Application layer.
IP and Errors IP Best Effort Datagrams can be: –Lost –Delayed –Duplicated –Delivered out of order –Corrupted.
Presentation Services  need for a presentation services  ASN.1  declaring data type  encoding data types  implementation issues  reading: text, section.
Introduction to Networking and TCP/IP J. H. Wang Jun. 8, 2005.
Networks – Network Architecture Network architecture is specification of design principles (including data formats and procedures) for creating a network.
 Socket  The combination of an IP address and a port number. (RFC 793 original TCP specification)  The name of the Berkeley-derived application programming.
Jozef Goetz, Application Layer PART VI Jozef Goetz, Position of application layer The application layer enables the user, whether human.
Component 9 – Networking and Health Information Exchange Unit 1-1 ISO Open Systems Interconnection (OSI) This material was developed by Duke University,
University of the Western Cape Chapter 12: The Transport Layer.
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)
2: Application Layer1 Chapter 2 Application Layer Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012.
Chapter 4: Interprocess Communication‏ Pages
Dr. John P. Abraham Professor University of Texas Pan American Internet Applications and Network Programming.
1. I NTRODUCTION TO N ETWORKS Network programming is surprisingly easy in Java ◦ Most of the classes relevant to network programming are in the java.net.
CCNA 1 v3.0 Module 11 TCP/IP Transport and Application Layers.
Chapter 2 Applications and Layered Architectures Sockets.
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.
4061 Session 25 (4/17). Today Briefly: Select and Poll Layered Protocols and the Internets Intro to Network Programming.
CSE 451: Operating Systems Winter 2015 Module 22 Remote Procedure Call (RPC) Mark Zbikowski Allen Center 476 © 2013 Gribble, Lazowska,
Page 1 Remote Procedure Calls Paul Krzyzanowski Distributed Systems Except as otherwise noted, the content of this presentation.
Chapter 27 Socket API Interface The interface between an application program and the communication protocols in an operating system is known as the Application.
Remote Procedure CallCS-502 Fall Remote Procedure Call (continued) CS-502, Operating Systems Fall 2007 (Slides include materials from Operating System.
Socket Programming Introduction. Socket Definition A network socket is one endpoint in a two-way communication flow between two programs running over.
The Client-Server Model And the Socket API. Client-Server (1) The datagram service does not require cooperation between the peer applications but such.
Part 4: Network Applications Client-server interaction, example applications.
Advanced UNIX programming Fall 2002, lecture 16 Instructor: Ashok Srinivasan Acknowledgements: The syllabus and power point presentations are modified.
1 Kyung Hee University Chapter 11 User Datagram Protocol.
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 Network Communications A Brief Introduction. 2 Network Communications.
Distributed Computing & Embedded Systems Chapter 4: Remote Method Invocation Dr. Umair Ali Khan.
Process-to-Process Delivery:
SOCKET PROGRAMMING Presented By : Divya Sharma.
1 Chapter 24 Internetworking Part 4 (Transport Protocols, UDP and TCP, Protocol Port Numbers)
Presentation Services
The Transport Layer Implementation Services Functions Protocols
NET323 D: Network Protocols
CSE 451: Operating Systems Winter 2006 Module 20 Remote Procedure Call (RPC) Ed Lazowska Allen Center
NET323 D: Network Protocols
Process-to-Process Delivery:
CSC Advanced Unix Programming, Fall 2015
CSE 451: Operating Systems Winter 2004 Module 19 Remote Procedure Call (RPC) Ed Lazowska Allen Center
CSE 451: Operating Systems Autumn 2009 Module 21 Remote Procedure Call (RPC) Ed Lazowska Allen Center
CSE 451: Operating Systems Autumn 2010 Module 21 Remote Procedure Call (RPC) Ed Lazowska Allen Center
Process-to-Process Delivery: UDP, TCP
CSE 451: Operating Systems Messaging and Remote Procedure Call (RPC)
Exceptions and networking
Presentation transcript:

Presentation Services  need for a presentation services  ASN.1  declaring data type  encoding data types  implementation issues  reading: Tannenbaum 7.3.2

Presentation Services: Motivation Question: suppose we could copy reliably from one computer’s memory to another. Would this “solve” communication problem? Answer: ? Crux of problem:  deal with meaning of information, not representation  different computers, OS, compilers have different conventions for representing data  architecture: big endian versus little endian  floating point format  data type size: 16, 32, 64 bit int  different size, layout of data structures

Solving the representation problem  have sender encode to receiver’s format  have receiver decode from sender’s format  have machine-, OS-, language-independent method for describing data structures  host translates to/from universal description language from/to own format  pros and cons?

ASN.1: Abstract Syntax Notation 1 ISO standard (one still meaningful) abstract syntax: “language” for describing data structures  data description language, not programming language  defines universal data types  allows user-defined data types basic encoding rules:  convert abstract syntax specification of data structure into series of bytes (for transmission)

ASN.1: a pictorial view

ASN.1: Universal Types predefined types with given tag value Example declarations: think of ::= as defining new data type in terms of universal data type Married ::= BOOLEAN SSN ::= INTEGER Lname ::= OCTETSTRING Salary ::= REAL IPAddress ::= OCTETSTRING (SIZE 4)

ASN.1 Syntax: constructors ASN.1 defines constructor types for building more complex data types of “simpler” data types: example of constructed data type: studentRecord ::= SEQUENCE { Lname OCTETSTRING, Lname OCTETSTRING, Fname OCTETSTRING, Fname OCTETSTRING, Mname OCTETSTRING, Mname OCTETSTRING, Married BOOLEAN DEFAULT FALSE, Married BOOLEAN DEFAULT FALSE, SSN INTEGER SSN INTEGER }

ASN.1 Encoding Example The ASN.1 definition: Attendee ::= SEQUENCE { name OCTET STRING, name OCTET STRING, paid BOOLEAN } paid BOOLEAN } The data {“Smith”,T} would be encoded: Note nesting of TLV structure in above example

ASN.1: But how do I use it? Normal people don’t want to write encoding/decoding routines! ASN.1 “compilers” take ASN.1 abstract syntax module and produce  C data type definitions (e.g., typedef’s) that user can #include to create data structures having these types  library of C-callable rouitnes (e.g., one for each data type) to encode/decode each typedef to/from TLV encoding

External Data Representation: XDR  developed by SUN (RFC 1014)  similar to ASN.1 in power  the de facto standard for most client-server applications  underlies SUN RPC and NFS  both stream oriented (TCP) and record oriented (UDP)  XDR can be combined with remote procedure calls  rpcgen compiler allows you to write rpc and encodes data in XDR format

Presentation Services: closing thoughts  presentation processing expensive:  up to 90% processing time on ethernet/IP/TCP/presentation stack  cost to encode array of int’s 5-20 times more expensive than copy  too heavyweight?  interesting reading:  John Larmouth's book "Understanding OSI" : chapter 8: ASN.1 chapter 8: ASN.1chapter 8: ASN.1  role of ASN.1 in next generation http next generation httpnext generation http  Neufeld and Y. Yang, “An ASN.1 to C compiler,” IEEE Trans. Software Engineering, Oct  C. Huitema and A. Doghri, “Defining Faster Transfer Syntaxes for the OSI Presentation Protocol,” ACM Computer Communication Rev. Oct  D.E. Comer, D.L. Stevens, Internetworking with TCP/IP, vol. III, Prentice Hall, 1994.

Network Application Programming Introduction: issues Sockets: programming and implementation Other API’s:  winsock  java  transport layer interface (TLI)  Novell netware API Reading: Tannenbaum, page , KR Chapter 2 ftp://gaia.cs.umass.edu/cs653/sock.ps ftp://gaia.cs.umass.edu/cs653/sock.ps

The Application Programming Interface: API  API: the programming model, application callable services, interfaces, and abstractions provided by the network (i.e., lower layers) to the application.  does an API provide for:  naming and service location: must application know precise location (e.g., host address and port) of service? Can services be requested by name? Can servers registers services?  connection management. must applications do low- level handshaking required to setup/teardown connection?

The API (continued) Does an API provide for:  message transfer  application-selectable data transfer services: best-effort versus reliable?  message priorities?  multi-site atomic actions?  structured versus byte-stream communication?  communication flexibility  can application select and/or modify protocol stacks (statically or dynamically)?  Quality of Service specification  can application specify QoS requirements to network?

The SOCKET API  introduced in 1981 BSD 4.1 UNIX  a host-local, application created/owned, OS- controlled interface into which application process can both send and receive messages to/from another (remote or local) application process

The SOCKET API (cont)  two sockets on separate hosts ``connected'' by OS socket management routines. Application only sees local socket.  sockets explicitly created, used, released by applications  based on client/server paradigm  two types of transport service via socket API:  unreliable datagram  reliable, stream-oriented  presentation, session layers missing in UNIX networking (an application concern!).

Sockets: conceptual view  each socket has separate send/receive buffers, port id, parameters (application queryable and setable).  socket operations implemented as system calls into OS  user/kernel boundary crossed: overhead

Sockets: conceptual view buffered data yet to send buffered data yet to be sent port # socket parameters USERAPP. SOCKETLAYER TRANSPORT LAYER msgsend()bind()msgsrecv()getsockopt() setsocketopt() ? Userspace Operatingsystem

Connectionless Service  datagram service: underlying transport protocols do not guarantee delivery  no explicit identification of who is server, who is client  if initiating contact with other side, need to know  IP address  port number of process waiting to be contacted.  if waiting for contact from other side, need to declare  port number at which waiting for other side

1.create transport endpoint: socket() 2. assign transport endpoint an address: bind() 3. wait for pkt to arrive: recvfrom() 4. send reply (if any): sendto() 5. release transport endpoint: close() 1. create transport endpoint: socket() 2. assign transport endpoint address: (optional) bind() 3. determine address of server 4. send msg: sendto() 5. wait for pkt to arrive: recvfrom() 6. Release transport endpoint: close() CLIENT SERVER

DNS: Internet Domain Name System  a distributed database used by TCP/IP applications to map to/from hostnames from/to IP addresses  name servers :  user-level library routines gethostbyname() and gethostbyaddress() contact local nameserver via port 53  name server returns IP address of requested hostname

DNS: non-local names finding non-local names  no single name server has complete info  if local name server can't resolve address, contacts root name server:  9 redundant root nameservers world-wide  each has addresses of names servers for all level-two name servers (e.g., umass.edu, ibm.com)  contacted root server returns IP address of name server resolver should contact  contacted level-two name server may itself return a pointer to another name server  name resolution an iterative process of following name server pointers  DNS protocol specifies packet formats for exchanges with DNS servers

Assigning socket a network address: bind()  each socket must be associated with a local, host-unique 16-bit port number.  need to associate socket with globally unique network address (host address and port)  OS knows that incoming messages addressed to this host address and port to be delivered (demultiplexed to) to this socket  a return address for outgoing messages

Port Numbers

Connection-oriented service

SERVER assign address to transport endpointbind() to transport endpoint:bind() CLIENT create transport endpoint: socket() assign trasnport endpoint an address (optional) :bind() announce willing to accept connections: listen() block/wait for incoming conn. req.: accept()(new socket created on return) wait for pkt:recvfrom() send reply (if any):sendto() connect to server via socket: connect() release transport endpoint:close() send msg: sendto() wait for reply:recvfrom() create transport endpoint:socket() for incoming requests release transport endpoint:close() determine addr. of server msg exchange and synch. request reply

Connection-oriented service  client/server handshaking:  client must explicitly connect to server before sending or receiving data  client will not pass connect() until server accepts client  server must explicitly accept client before sending or receiving data  server will not pass accept() until client connect()'s  connection-oriented service: underlying transport service is reliable, stream-oriented.

Typical server structure

Aside: other useful system calls and routines  close(sockfd) will release a socket  getsockopt() and setsockopt() system calls used to query/set socket options.  ioctl() system call used to query/set socket attributes, also network device interface attributes.

Implementation: OS actions on sendto()

Windows Sockets Based on BSD sockets:  BSD: ``the de facto standard for TCP/IP Networking'' (quote from Winsock1.1 documentation)  supports stream(TCP)/datagram(UDP) model  API the same as what we have seen A few differences/incompatibilities:  extensions for asynchronous programming  different error return codes: -1 not the error return code!  socket identifier different from file identifier  read(), write(), close() should not be used  use socket-specific equivalents instead

API: Summary  some API’s provide only low-level interface to transport services: socket, winsock, TLI  other API’s provide higher-level services (e.g., transaction support, service advertising or request)  makes building applications easier  sockets the de facto standard  FYI reading:  winsock: winsock: winsock:  JAVA: JAVA: JAVA:  Tutorial on sockets: Tutorial on sockets: Tutorial on sockets: