Chapter 3. Internet Applications and Network Programming

Similar documents
Introduction to Computer Networks

Network Programming TDC 561

Network-Oriented Software Development. Course: CSc4360/CSc6360 Instructor: Dr. Beyah Sessions: M-W, 3:00 4:40pm Lecture 2

Chapter 11. User Datagram Protocol (UDP)

Limi Kalita / (IJCSIT) International Journal of Computer Science and Information Technologies, Vol. 5 (3), 2014, Socket Programming

Protocols and Architecture. Protocol Architecture.

IP Network Layer. Datagram ID FLAG Fragment Offset. IP Datagrams. IP Addresses. IP Addresses. CSCE 515: Computer Network Programming TCP/IP

Distributed Systems. 2. Application Layer

First Workshop on Open Source and Internet Technology for Scientific Environment: with case studies from Environmental Monitoring

Objectives of Lecture. Network Architecture. Protocols. Contents

CSIS CSIS 3230 Spring Networking, its all about the apps! Apps on the Edge. Application Architectures. Pure P2P Architecture

Basic Networking Concepts. 1. Introduction 2. Protocols 3. Protocol Layers 4. Network Interconnection/Internet

Lecture 2-ter. 2. A communication example Managing a HTTP v1.0 connection. G.Bianchi, G.Neglia, V.Mancuso

Network Programming with Sockets. Process Management in UNIX

Internet Firewall CSIS Packet Filtering. Internet Firewall. Examples. Spring 2011 CSIS net15 1. Routers can implement packet filtering

ICT SEcurity BASICS. Course: Software Defined Radio. Angelo Liguori. SP4TE lab.

Socket Programming in C/C++

Access Control: Firewalls (1)

PART OF THE PICTURE: The TCP/IP Communications Architecture

Introduction to Socket Programming Part I : TCP Clients, Servers; Host information

Computer Networks. Chapter 5 Transport Protocols

Transport Layer. Chapter 3.4. Think about

Introduction to Analyzer and the ARP protocol

CPS221 Lecture: Layered Network Architecture

Application Layer. CMPT Application Layer 1. Required Reading: Chapter 2 of the text book. Outline of Chapter 2

Ethernet. Ethernet. Network Devices

File Transfer And Access (FTP, TFTP, NFS) Chapter 25 By: Sang Oh Spencer Kam Atsuya Takagi

SSC - Communication and Networking Java Socket Programming (II)

1 Data information is sent onto the network cable using which of the following? A Communication protocol B Data packet

ICOM : Computer Networks Chapter 6: The Transport Layer. By Dr Yi Qian Department of Electronic and Computer Engineering Fall 2006 UPRM

Computer Networks UDP and TCP

The TCP/IP Reference Model

Internet Protocol (IP) IP - Network Layer. IP Routing. Advantages of Connectionless. CSCE 515: Computer Network Programming IP routing

Computer Networks/DV2 Lab

Understanding TCP/IP. Introduction. What is an Architectural Model? APPENDIX

Overview. Securing TCP/IP. Introduction to TCP/IP (cont d) Introduction to TCP/IP

Final for ECE374 05/06/13 Solution!!

Per-Flow Queuing Allot's Approach to Bandwidth Management

Note! The problem set consists of two parts: Part I: The problem specifications pages Part II: The answer pages

Transport Layer Protocols

Transport and Network Layer

Socket = an interface connection between two (dissimilar) pipes. OS provides this API to connect applications to networks. home.comcast.

Protocols. Packets. What's in an IP packet

[Prof. Rupesh G Vaishnav] Page 1

Note! The problem set consists of two parts: Part I: The problem specifications pages Part II: The answer pages

Computer Networks. Examples of network applica3ons. Applica3on Layer

Topics. Computer Networks. Let s Get Started! Computer Networks: Our Definition. How are Networks Used by Computers? Computer Network Components

Tutorial on Socket Programming

Lecture 28: Internet Protocols

Computer Networks & Security 2014/2015

Chapter 5. Transport layer protocols

1 An application in BPC: a Web-Server

Slide 1 Introduction cnds@napier 1 Lecture 6 (Network Layer)

District of Columbia Courts Attachment 1 Video Conference Bridge Infrastructure Equipment Performance Specification

Principles of Network Applications. Dr. Philip Cannata

Firewalls. Test your Firewall knowledge. Test your Firewall knowledge (cont) (March 4, 2015)

Technical Support Information Belkin internal use only

What is CSG150 about? Fundamentals of Computer Networking. Course Outline. Lecture 1 Outline. Guevara Noubir noubir@ccs.neu.

Sage ERP Accpac Online

Internetworking and IP Address

Sage 300 ERP Online. Mac Resource Guide. (Formerly Sage ERP Accpac Online) Updated June 1, Page 1

Top-Down Network Design

Computer Networks Network architecture

Wharf T&T Limited DDoS Mitigation Service Customer Portal User Guide

Overview of Computer Networks

Dissertation Title: SOCKS5-based Firewall Support For UDP-based Application. Author: Fung, King Pong

Design of an Application Programming Interface for IP Network Monitoring

Mathatma Gandhi University

Firewall Introduction Several Types of Firewall. Cisco PIX Firewall

Network Applications

Internet Protocol: IP packet headers. vendredi 18 octobre 13

TCP/IP Fundamentals. OSI Seven Layer Model & Seminar Outline

Voice over IP: RTP/RTCP The transport layer

IP address format: Dotted decimal notation:

UNIX Sockets. COS 461 Precept 1

CS 457 Lecture 19 Global Internet - BGP. Fall 2011

The OSI model has seven layers. The principles that were applied to arrive at the seven layers can be briefly summarized as follows:

ELEN 602: Computer Communications and Networking. Socket Programming Basics

TCP Offload Engines. As network interconnect speeds advance to Gigabit. Introduction to

Chapter 3. TCP/IP Networks. 3.1 Internet Protocol version 4 (IPv4)

Computer Systems Structure Input/Output

We will give some overview of firewalls. Figure 1 explains the position of a firewall. Figure 1: A Firewall

Introdução aos Sistemas Distribuídos

Protocol Data Units and Encapsulation

point to point and point to multi point calls over IP

CS514: Intermediate Course in Computer Systems

Network Configuration Settings

Guide to Network Defense and Countermeasures Third Edition. Chapter 2 TCP/IP

(Refer Slide Time: 02:17)

INTRODUCTION TO FIREWALL SECURITY

Hands-on Network Traffic Analysis Cyber Defense Boot Camp

Advanced Networking Voice over IP: RTP/RTCP The transport layer

8.2 The Internet Protocol

From Centralization to Distribution: A Comparison of File Sharing Protocols

LESSON Networking Fundamentals. Understand TCP/IP

Transcription:

Chapter 3 Internet Applications and Network Programming 1

Introduction The Internet offers users a rich diversity of services none of the services is part of the underlying communication infrastructure Internet provides a general purpose mechanism on which all services are built and individual services are supplied by application programs that run on computers attached to the Internet 2

Two Basic Internet Communication Paradigms The Internet supports two basic communication paradigms: Stream Transport in the Internet Message Transport in the Internet 1-to-1/ One-to- Many or multicasting Pouring Water One bucket at a time 3

Stream Transport in the Internet Stream denotes a paradigm in which a sequence of bytes flows from one application program to another without inserting boundaries thus, there is no frame concept! can choose to generate one byte at a time, or can generate blocks of bytes The network chooses the number of bytes to deliver at any time the network can choose to combine smaller blocks into one large block or can divide a large block into smaller blocks 4

Message Transport in the Internet In a message paradigm, the network accepts and delivers messages if a sender places exactly n bytes in an outgoing message, the receiver will find exactly n bytes in the incoming message The message paradigm allows delivery in different forms: Unicast a message can be sent from an application on one computer directly to an application on another, 1-to-1 Multicast a message can be multicast to some of the computers on a network, 1-tomany (in anycasting destination is not identified) Broadcast a message can be broadcast to all computers on a given network, 1-to-all 5

Message Transport in the Internet Message service does not make any guarantees So messages may be Lost (i.e., never delivered) Duplicated (more than one copy arrives) Delivered out-of-order Most applications require delivery guarantees Programmers tend to use the stream service except in special situations such as video, where multicast is needed and the application provides support to handle packet reordering and loss 6

Connection-Oriented Communication The Internet stream service is connection-oriented It operates analogous to a telephone call: 1. two applications must request that a connection be created 2. once it has been established, the connection allows the applications to send data in either direction 3. finally, when they finish communicating, the applications request that the connection be terminated 7

The Client-Server Model of Interaction Main question: how can a pair of applications that run on two independent computers coordinate to guarantee that they request a connection at the same time? The answer lies in a form of interaction known as the client-server model First: A server starts and awaits contact Second: A client starts and initiates the connection Evolution: main frames / PC / Client-Server / Cloud! 8

The Client-Server Model of Interaction REQ: Send me this Client RSP: Here it is ACK: I received x bytes Server 9

Characteristics of Clients and Servers Most instances of client-server interaction have the same general characteristics A client software: Is an arbitrary application program that becomes a client temporarily when remote access is needed Is invoked directly by a user, and executes only for one session Runs locally on a user's personal computer Actively initiates contact with a server Can access multiple services as needed, but usually contacts one remote server at a time Does not require especially powerful computer hardware A server software: Is a special-purpose, privileged program Is dedicated to providing one service that can handle multiple remote clients at the same time Is invoked automatically when a system boots, and continues to execute through many sessions Runs on a large, powerful computer Waits passively for contact from arbitrary remote clients Accepts contact from arbitrary clients, but offers a single service Requires powerful hardware and a sophisticated operating system (OS) Example: Outlook and Exchange server / Browser and Web server 10

Requests, Responses, and Direction of Data Flow Once contact has been established, two-way communication is possible (i.e., data can flow from a client to a server or from a server to a client) In some cases, a client sends a series of requests and the server issues a series of responses (e.g., a database client might allow a user to look up more than one item at a time) 11

Multiple Clients and Multiple Servers Allowing a given computer to operate multiple servers is useful because the hardware can be shared a single computer has lower system administration overhead than multiple computer systems In many cases the demand for a server is often sporadic a server can remain idle for long periods of time an idle server does not use the CPU while waiting for a request to arrive If demand for services is low, consolidating servers on a single computer can dramatically reduce cost without significantly reducing performance 12

Server Identification and Demultiplexing How does a client identify/find a server? The Internet protocols divide identification into two pieces: An identifier for the computer on which a server runs An identifier for a service (application) on the computer Identifying a computer? Each computer in the Internet is assigned a unique 32-bit identifier known as an Internet Protocol address (IP address) A client must specify the server s IP address (132.98.12.70) Identifying a service? Each service available in the Internet is assigned a unique 16-bit identifier known as a protocol port number (or port number) Examples, email à port number 25, and the web à port number 80 Computer ID (IP) Service ID (Port) 13

Server Identification and Demultiplexing 4 5 6 1 2 3 See Notes! DNS: Domain Name Server http://www.who.is/whois-lookup/ 14

Applications and Ports Physical Physical 15

Concurrent Servers Most servers are concurrent That is, a server uses more than one thread of control Concurrent execution depends on the OS being used Concurrent server code is divided into two pieces a main program (thread) a handler The main thread accepts contact from a client and creates a thread of control for the client Each thread of control interacts with a single client and runs the handler code Contact request from the client Thread of control to communicate with the client Main (thread) code - Accept contact - Creates a handler - - Wait for a new contact Handler Code Client/Server 16

Concurrent Servers After handling one client the thread terminates The main thread keeps the server alive after creating a thread to handle a request the main thread waits for another request to arrive If N clients are simultaneously using a concurrent server, N +1 threads will be running: the main thread (1) is waiting for additional requests and N threads are each interacting with a single client 17

Peer-to-Peer Interactions If a single server provides a given service the network connection between the server and the Internet can become a bottleneck Central Bottleneck à Slow download! 18

Peer-to-Peer Interactions Can Internet services be provided without creating a central bottleneck? One way to avoid a bottleneck forms the basis of file sharing known as a peer-to-peer (P2P) architecture The scheme avoids placing data on a central server data is distributed equally among a set of N servers and each client request is sent to the appropriate server a given server only provides 1/N of the data the amount of traffic between a server and the Internet is 1/N as much as in the single-server architecture N servers 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved. 19

Bittorrent Smarter Peer-to-Peer approach A browser-like application to download files faster http://player.vimeo.com/video/15228767 More users downloading results in faster download! Eliminate the central bottleneck 20

Network Programming and the Socket API The interface an application uses to specify communication is known as an Application Program Interface (API) Details of an API depend on the OS One particular API has emerged as the de facto standard for software that communicates over the Internet known as the socket API, and commonly abbreviated sockets Sockets are a software methodology to connect different processes (programs) on the same computer or on different computers. The name "socket" reminds us that once we "plug in" one process into another process's socket, they can talk to each other by reading and writing the socket. 21 http://www.troubleshooters.com/codecorn/sockets/#introduction

Introduction to Sockets What exactly creates a Socket? <IP address, Port #> tuple What makes a connection? {Source<IP address, Port #>, Destination <IP address, Port #>} i.e. source socket destination socket pair uniquely identifies a connection. Example 1343 Client 192.168.0.2 Server 192.168.0.1 80 1343 Client 192.168.0.3 5488 Client 192.168.0.4 22

Network Programming and the Socket API telnet 192.168.100.1 3333 Using telnet as the client program à connecting the client to port 3333 on 192.168.100.1 23

Example In this case we have two application programs: Server and client Note that they both have to be pointing to the same port! 24

Sockets, Descriptors, and Network I/O When an application creates a socket to use for Internet OS returns a small integer descriptor that identifies the socket The application then passes the descriptor as an argument when it calls functions to perform an operation on the socket (e.g., to transfer data across the network or to receive data) An application must specify many details, such as the address of a remote computer the protocol port number and whether the application will act as a client or as a server To avoid having a single socket function with many parameters, designers of the socket API chose to define many functions Remember: An application creates a socket, and then invokes functions for details 25

Socket Example Creating a set of functions that handle communications to write network applications Socket<PrototypeFamily Type Protocol> Send<socket data length flag> PrototypeFamily: TCP or UDP Type: Connectionless Protocol: Transport 26

27

Programming Client-Server Using Sockets Different programming languages can be used: C, JAVA, Shell 28