1 / 32

Introduction The API for the Internet protocols External data representation and marshalling

Chapter 4: Interprocess Communication. Introduction The API for the Internet protocols External data representation and marshalling Client-Server communication Group communication Case study: interprocess communication in Java. Introduction.

luke-boyer
Download Presentation

Introduction The API for the Internet protocols External data representation and marshalling

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 4: Interprocess Communication • Introduction • The API for the Internet protocols • External data representation and marshalling • Client-Server communication • Group communication • Case study: interprocess communication in Java

  2. Introduction • Internet and WWW have emerged as global media for communication and changing the way we conduct science, engineering, and commerce. • They also changing the way we learn, live, enjoy, communicate, interact, engage, etc. It appears like the modern life activities are getting completely centered around the Internet.

  3. Internet Applications Serving Local and Remote Users PC client Internet Server Local Area Network PDA

  4. The characteristics of interprocess communication • Synchronous and asynchronous • a queue associated with message destination, Sending process add message to remote queue, Receiving process remove message from local queue • Synchronous: send and receive are blocking operations • asynchronous: send is unblocking, receive could be blocking or unblocking (receive notification by polling or interrupt) • Message destination • Internet address + local port • service name: help by name service at run time • location independent identifiers, e.g. in Mach • Reliability • validity: messages are guaranteed to be delivered despite a reasonable number of packets being dropped or lost • Integrity: messages arrive uncorrupted and without duplication • Ordering • the messages be delivered in sender order

  5. A communication channel can be described in terms of four attributes Performance – dictated by the network latency and bandwidth Reliability Validity - a message put in the outgoing buffer is eventually delivered to the incoming message buffer Integrity – the message received is identical to the one sent, and no messages are delivered twice Ordering A channel is ordered if messages are delivered in the order in which they were sent Synchronicity Synchronous – each message transmitted over a channel is received within a known bounded time Asynchronous – message transmission time is unbounded Process p Process q send m receive Message (sequence of bytes) Communication channel Outgoing message buffer Incoming message buffer

  6. Every computer on the Internet has a unique identifier, its Internet address (IP address) The Internet protocol (IP) routes packets from one computer to another A router is a special-purpose computer which acts as an intermediary between a pair of communicating computers An IP packet includes: The identity of the sender machine – i.e. it’s IP address The identity of the machine to which the packet should be delivered The packet contents – application data The maximum size permitted for an IP packet is 64Kb In practice, this is too much for many networks to deliver in one chunk and the IP packet must be broken down into fragments The IP protocol takes care of disassembling a packet into fragments and subsequently reassembling the IP packet The Internet protocol The Internet is a packet-switching network. Packets sent between two computers do not necessarily follow the same path.

  7. IP as a basis for a communication channel • Performance • Depends on the underlying networks used • Reliability • No validity guarantees • Where an incoming message buffer is full (at the destination computer or any intermediate router), the packet will be dropped • No integrity guarantees • Packets may be corrupted as they travel through the network; any packet may arrive more than once at the destination • Ordering • No ordering guarantees – a sequence of packets may take different routes, incurring different transmission times • Synchronicity • Over a public network (e.g. the Internet) , asynchronous • For a closed network, synchronous is possible

  8. Chapter 4: Interprocess Communication • Introduction • The API for the Internet protocols • External data representation and marshalling • Client-Server communication

  9. Elements of C-S Computing a client, a server, and network • Processes follow protocol that defined a set of rules that must be observed by participants: • How the data is exchange is encoded? • How are events (sending, receiving) are synchronized (ordered) so that participants can send and receive in a coordinated manner? • Face-to-face communication, humans beings follow unspoken protocol based on eye contact, body language, gesture. Request Client Network Server Result Client machine Server machine

  10. Client/sever model • Client asks (request) – server provides (response) • Typically: single server - multiple clients • The server does not need to know anything about the client • even that it exists • The client should always know something about the server • at least where it is located

  11. Physical/Link Layer Functionality for the transmission of signals, representing a stream of data from one computer to another. Internet/Network Layer IP (Internet Protocols) – a packet of data to be addressed to a remote computer and delivered. Transport Layer Functionalities for delivering data packets to a specific process on a remote computer. TCP (Transmission Control Protocol) UDP (User Datagram Protocol) Programming Interface: Sockets Applications Layer Message exchange between standard or user applications: HTTP, FTP, Telnet TCP/IP Stack Networking Basics Application (http,ftp,telnet,…) Transport (TCP, UDP,..) Internet/Network (IP,..) Physical/Link (device driver,..)

  12. TCP (Transmission Control Protocol) is a connection-oriented communication protocol that provides a reliable flow of data between two computers. Example applications: HTTP FTP Telnet TCP/IP Stack Networking Basics Application (http,ftp,telnet,…) Transport (TCP, UDP,..) Internet/Network (IP,..) Physical/Link (device driver,..)

  13. UDP (User Datagram Protocol) is a connectionless communication protocol that sends independent packets of data, called datagrams, from one computer to another with no guarantees about arrival or order of arrival. Similar to sending multiple emails/letters to a friends, each containing part of a message. Example applications: Clock server Ping TCP/IP Stack Networking Basics Application (http,ftp,telnet,…) Transport (TCP, UDP,..) Network (IP,..) Link (device driver,..)

  14. Network Layering Application Application 7 Presentation Presentation 6 Session Session 5 Transport Transport 4 Network Network Network 3 Data link Data link Data link 2 Physical Physical Physical 1

  15. Network Layering • Why layering? Application Application 7 Presentation Presentation 6 Session Session 5 Transport Transport 4 Network Network Network 3 Data link Data link Data link 2 Physical Physical Physical 1

  16. Layering Makes it Easier • Application programmer • Doesn’t need to send IP packets • Doesn’t need to send Ethernet frames • Doesn’t need to know how TCP implements reliability • Only need a way to pass the data down • Socket is the API to access transport layer functions

  17. What Lower Layer Need to Know? • We pass the data down. What else does the lower layer need to know?

  18. What Lower Layer Need to Know? • We pass the data down. What else does the lower layer need to know? • How to identify the destination process? • Where to send the data? (Addressing) • What process gets the data when it is there? (Multiplexing)

  19. Identify the Destination • Addressing • IP address • hostname (resolve to IP address via DNS) • Multiplexing • port Server socket address 208.216.181.15:80 Client socket address 128.2.194.242:3479 FTP Server (port 21) Client HTTP Server (port 80) Connection socket pair (128.2.194.242:3479, 208.216.181.15:80) Client host address 128.2.194.242 Server host address 208.216.181.15

  20. The TCP and UDP protocols use ports to map incoming data to a particular process running on a computer. Understanding Ports server Port TCP Client app app app app port port port port TCP or UDP Packet Data port# data

  21. Understanding Ports • Port is represented by a positive (16-bit) integer value • Some ports have been reserved to support common/well known services: • ftp 21 • telnet 23 • smtp 25 • login 513 • http 80 • User level process/services generally use port number value >= 1024

  22. A port serves as a message source or destination With the Internet protocols, messages are sent to (Internet address, port) pairs A local port can be bound to no more than one process Processes may use multiple ports Port Agreed (destination) port Internet address Ports Web browser Web browser Web server Mail server 138.37.94.248

  23. Chapter 3: Interprocess Communication • Introduction • The API for the Internet protocols • External data representation and marshalling • Client-Server communication

  24. Sockets • How to use sockets • Setup socket • Where is the remote machine (IP address, hostname) • What service gets the data (port) • Send and Receive • Designed just like any other I/O in unix • send -- write • recv -- read • Close the socket

  25. Sockets • Sockets provide an interface for programming networks at the transport layer. • Network communication using Sockets is very much similar to performing file I/O • In fact, socket handle is treated like file handle. • The streams used in file I/O operation are also applicable to socket-based I/O • Socket-based communication is programming language independent. • That means, a socket program written in Java language can also communicate to a program written in Java or non-Java socket program.

  26. The Socket API • A socket API provides a programming construct termed a socket. A process wishing to communicate with another process must create an instance, or instantiate, such a construct. • The two processes then issue operations provided by the API to send and receive data.

  27. The conceptual model of the socket API

  28. Socket bound to (138.37.94.248, 80) Port 80 Sockets browser • A socket is a programming abstraction which provides an endpoint for communication • The receiver process’ socket must be bound to a local port and the Internet address of the computer on which the receiver runs • Messages sent to a particular Internet address and port number can be received only by a process whose socket is bound to that Internet address and port number • A socket is associated with a transport protocol – either TCP or UDP Web server 138.37.94.248 browser

  29. Socket types • Datagram socket – using UDP • Not sequenced • Not reliable • Not unduplicated • Connectionless • Border preserving • Stream socket – using TCP • Sequenced • Reliable • Unduplicated • Connection-oriented • Not border preserving • Raw and others (extracurricular)

  30. Socket Communication • A server (program) runs on a specific computer and has a socket that is bound to a specific port. The server waits and listens to the socket for a client to make a connection request. server Connection request port Client

  31. Socket Communication • If everything goes well, the server accepts the connection. Upon acceptance, the server gets a new socket bounds to a different port. It needs a new socket (consequently a different port number) so that it can continue to listen to the original socket for connection requests while serving the connected client. server port port Client port Connection

  32. Sockets and Java Socket Classes • A socket is an endpoint of a two-way communication link between two programs running on the network. • A socket is bound to a port number so that the TCP layer can identify the application that data destined to be sent. • Java’s .net package provides two classes: • Socket – for implementing a client • ServerSocket – for implementing a server

More Related