School of Engineering and Computer Science Victoria University of Wellington Copyright: Peter Andreae, VUW Networking COMP 112 2014 # 21.

Slides:



Advertisements
Similar presentations
© 2007 Cisco Systems, Inc. All rights reserved.Cisco Public 1 Version 4.0 Network Services Networking for Home and Small Businesses – Chapter 6.
Advertisements

Network Services Networking for Home & Small Business.
Socket Programming.
A CHAT CLIENT-SERVER MODULE IN JAVA BY MAHTAB M HUSSAIN MAYANK MOHAN ISE 582 FALL 2003 PROJECT.
1 Java Networking – Part I CS , Spring 2008/9.
Networking Theory (Part 1). Introduction Overview of the basic concepts of networking Also discusses essential topics of networking theory.
Networks 1 CS502 Spring 2006 Network Input & Output CS-502 Operating Systems Spring 2006.
© Lethbridge/Laganière 2001 Chap. 3: Basing Development on Reusable Technology 1 Let’s get started. Let’s start by selecting an architecture from among.
CS-3013 & CS-502, Summer 2006 Network Input & Output1 CS-3013 & CS-502, Summer 2006.
COMPUTER NETWORKS.
I NTRODUCTION OF S OCKET P ROGRAMMING L.Aseel AlTurki King Saud University.
CEG3185 Tutorial 4 Prepared by Zhenxia Zhang Revised by Jiying Zhao (2015w)
TCP/IP Web Design & Layout January 23, TCP/IP For Dummies  The guts and the rules of the Internet and World Wide Web. A set of protocols, services,
Process-to-Process Delivery:
CP476 Internet ComputingCh.1 # 1 Lecture 2. A Brief Introduction to the Internet The objective is to understand The history of Internet What the Internet.
Computer Networks  Network - A system of computers interconnected in order to share information.  Data transmission - consists of sending and receiving.
TCP/IP protocols Communication over Internet is mostly TCP/IP (Transmission Control Protocol over Internet Protocol) TCP/IP "stack" is software which allows.
Chapter 17 Networking Dave Bremer Otago Polytechnic, N.Z. ©2008, Prentice Hall Operating Systems: Internals and Design Principles, 6/E William Stallings.
NET0183 Networks and Communications Lecture 31 The Socket API 8/25/20091 NET0183 Networks and Communications by Dr Andy Brooks Lecture powerpoints from.
© 2007 Cisco Systems, Inc. All rights reserved.Cisco Public ITE PC v4.0 Chapter 1 1 Network Services Networking for Home and Small Businesses – Chapter.
TCP/IP: Basics1 User Datagram Protocol (UDP) Another protocol at transport layer is UDP. It is Connectionless protocol i.e. no need to establish & terminate.
Network Services Networking for Home & Small Business.
© 2007 Cisco Systems, Inc. All rights reserved.Cisco Public 1 Version 4.0 Network Services Networking for Home and Small Businesses – Chapter 6.
I. Basic Network Concepts. I.1 Networks Network Node Address Packet Protocol.
Digital Multimedia, 2nd edition Nigel Chapman & Jenny Chapman Chapter 17 This presentation © 2004, MacAvon Media Productions Multimedia and Networks.
Vassil Roussev 2 A socket is the basic remote communication abstraction provided by the OS to processes. controlled by operating system.
School of Engineering and Computer Science Victoria University of Wellington Copyright: Peter Andreae david streader, VUW Echo Networking COMP
 TCP (Transport Control Protocol) is a connection-oriented protocol that provides a reliable flow of data between two computers.  TCP/IP Stack Application.
Routers and Routing Basics CCNA 2 Chapter 10.
Chapter 6-2 the TCP/IP Layers. The four layers of the TCP/IP model are listed in Table 6-2. The layers are The four layers of the TCP/IP model are listed.
Practicum: - Client-Server Computing in Java Fundamental Data Structures and Algorithms Margaret Reid-Miller 13 April 2004.
Application Layer 2-1 Chapter 2 Application Layer Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012.
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.
Information Flow Across the Internet. What is the Internet? A large group of computers that link together to form the Worldwide Area Network (WAN)
© Lethbridge/Laganière 2005 Chap. 3: Basing Development on Reusable Technology The Client-Server Architecture A distributed system is a system in.
1 Chapter 28 Networking. 2 Objectives F To comprehend socket-based communication in Java (§28.2). F To understand client/server computing (§28.2). F To.
Transport Layer COM211 Communications and Networks CDA College Theodoros Christophides
School of Engineering and Computer Science Victoria University of Wellington Copyright: Peter Andreae, VUW Networking COMP # 22.
School of Engineering and Computer Science Victoria University of Wellington Copyright: Peter Andreae david streader, VUW Networking and Concurrency COMP.
CS390- Unix Programming Environment CS 390 Unix Programming Environment Java Socket Programming.
Data Communications and Networks
Java Sockets Tutorial Rahul Malik Nov 12, 2005.
Multimedia and Networks. Protocols (rules) Rules governing the exchange of data over networks Conceptually organized into stacked layers – Application-oriented.
Networking Basics CCNA 1 Chapter 11.
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.
Digital Multimedia, 2nd edition Nigel Chapman & Jenny Chapman Chapter 17 This presentation © 2004, MacAvon Media Productions Multimedia and Networks.
Advanced UNIX programming Fall 2002, lecture 16 Instructor: Ashok Srinivasan Acknowledgements: The syllabus and power point presentations are modified.
CSI 3125, Preliminaries, page 1 Networking. CSI 3125, Preliminaries, page 2 Networking A network represents interconnection of computers that is capable.
Prepared by Dr. Jiying Zhao University of Ottawa Canada.
UNIT-6. Basics of Networking TCP/IP Sockets Simple Client Server program Multiple clients Sending file from Server to Client Parallel search server.
Socket programming in C. Socket programming Socket API introduced in BSD4.1 UNIX, 1981 explicitly created, used, released by apps client/server paradigm.
Agenda Socket Programming The OSI reference Model The OSI protocol stack Sockets Ports Java classes for sockets Input stream and.
School of Engineering and Computer Science Victoria University of Wellington Copyright: Peter Andreae, VUW IRC, parsing, protocols COMP # 25.
SOCKET PROGRAMMING WITH JAVA By Collin Donaldson.
1 Network Communications A Brief Introduction. 2 Network Communications.
School of Engineering and Computer Science Victoria University of Wellington Copyright: Peter Andreae david streader, VUW Echo Networking COMP
Liang, Introduction to Java Programming, Ninth Edition, (c) 2013 Pearson Education, Inc. All rights reserved. 1 Chapter 33 Networking.
Echo Networking COMP
Networking COMP
Vocabulary Prototype: A preliminary sketch of an idea or model for something new. It’s the original drawing from which something real might be built or.
Layered Architectures
Networking for Home and Small Businesses – Chapter 6
Understanding the OSI Reference Model
Networking for Home and Small Businesses – Chapter 6
Multimedia and Networks
Process-to-Process Delivery:
Starting TCP Connection – A High Level View
Networking for Home and Small Businesses – Chapter 6
Presentation transcript:

School of Engineering and Computer Science Victoria University of Wellington Copyright: Peter Andreae, VUW Networking COMP # 21

COMP112 21: 2 Menu Networking Image recognition Admin Test results Wed Tutorial & Thursday Lecture: review of test and graphics assign. No Tutorial Wed 14 (Graduation Ceremony)

COMP112 21: 3 The Test It was clearly too long (should have been about 70 mins) The “easy” questions were too rushed Very few people attempted both of questions 6 & 7. Therefore, initial scaling is to make the test out of 40. There may be more scaling (upward). raw gradeDC-CC+B-BB+A-AA+ scaled40%50%55%60%65%70%75%80%85%90%

COMP112 21: 4 Networking Computers are (mostly) networked ie, connected to other computers: desktops, laptops embedded controllers servers phones sensors Users expect to be able communicate with the world Computers may require networking to operate How does it work? How can we write programs that use the network?

COMP112 21: 5 What’s required to communicate?

COMP112 21: 6 Levels of communication transmitting a character over the wire, fibre, or wireless chunking a message into “packets” ensuring that a packet is not corrupted or lost dealing with multiple packets from multiple computers on the same wire at the same time specifying where a packet should go to working out how to get a packet to its destination ensuring that a collection of packets making a message all arrive in order. specifying a message in a way that the recipient(s) will understand managing a “conversation” with a distant server. keeping track of multiple connections with multiple computers

COMP112 21: 7 TCP/IP Stack Layers of programs that build on each other. Application Layer Transport Layer Internet Layer Network Access Layer Each layer treats the layer below it as a black box which provides an abstraction that hides the lower level details.

COMP112 21: 8 TCP/IP Stack Network Access Layer (eg, Ethernet protocol) Part of the operating system Encoding a packet into signals to go over a wire/fibre/wireless to the computer at the other end of the wire, and decoding it. Dealing with collisions

COMP112 21: 9 TCP/IP Stack Internet Layer (eg, IP protocol) Part of operating system Encoding information into a packet with address information Dealing with addresses and routing a packet to the target computer at the other side of the network. Network Access Layer

COMP112 21: 10 TCP/IP Stack Transport Layer (eg TCP protocol) Part of operating system Ensuring sequence of packets in a message all arrive in order Protocol to acknowledge, recover, resend, reorder. Internet Layer Network Access Layer There are other protocols that work differently

COMP112 21: 11 TCP/IP Stack Application Layer Programs that need to communicate Clients and Servers Transport Layer Internet Layer Network Access Layer

COMP112 21: 12 Application Layer view Application wants a communication channel with a program running on a target computer over the network. TCP (Transport Layer) provides “Sockets”: A socket is one end of a TCP connection Has two streams associated with it: Input stream (from the other end of the connection) Application can read from it Output stream (to the other end of the connection) Application can write/print to it

COMP112 21: 13 Using sockets in Java Easy! Streams are sequences of characters Like files, or UI text pane, or System.in/System.out try { Socket socket = get a socket somehow ; Scanner inputFromTarget = new Scanner(socket.getInputStream()); PrintStream outputToTarget = new Scanner(socket.getOutputStream()); while (inputFromTarget.hasNext()){ String line = inputFromTarget.nextLine(); String response = work out a response ; outputToTarget.println(response); flush(response); } } catch (IOException e){System.out.println(“connection failure ”+e); }

COMP112 21: 14 Getting a Socket Connection requires each computer to set up a socket connected to the other How do you specify where you want the connection to go to? Which program running on which computer is going to server you a web page? Which program goes first? Need a connection at the other end in order to set up the one at this end!

COMP112 21: 15 Addressing a connection Two parts to the address: host computer: IP address, or Host name “port” (an integer) Each computer on the network must have an IP address or “debretts.ecs.vuw.ac.nz” Operating system provides a set of “ports” that connections can be associated with. Many programs have a standard port number. Application can specify a remote host and a port. Can hope the program at the other end will listen 1 2 : 80 : : 80 : 6667

COMP112 21: 16 Who goes first? If application requests connection to a port on a remote host, but there is no application on that port at the remote host that will respond to the request, connection will fail. Need to have an application on remote host listening to the port: Client – Server model: If host provides some service: Server application must be running on remote host Server application must be listening on a well-known port Client application can request a connection to host : port Server application will hear, and can accept the request Operating systems will set up a new socket on each end with a connection between them.

COMP112 21: 17 Addressing a connection Host1 1 2 : 80 : 6667 Host2 1 2 : 80 : 6667 Listening on port 6667 Request connection to port 6667 on Host2 via port xx Application accepts connection OS creates socket connected to port xx on Host1 OS creates socket connected to port 6667 on Host2 xx Application is still listening!

COMP112 21: 18 Setting up the sockets try { ServerSocket serverSocket = new ServerSocket(PORT); while (true) { Socket socket = serverSocket.accept(); … set up Scanner and PrintStream and communicate via socket } } catch (IOException e){System.out.println("Failed connection "+ e); } try { Socket socket = new Socket(("irc.ecs.vuw.ac.nz", PORT); …set up Scanner and PrintStream and communicate via socket } catch (IOException e){System.out.println("Failed connection "+ e); } Server Client