CSE 341, S. Tanimoto Java networking- 1 Java Networking Motivation Network Layers Using Sockets A Tiny Server Applets URLs Downloading Images, MediaTracker.

Slides:



Advertisements
Similar presentations
Using TCP sockets in Java Created by M Bateman, A Ruddle & C Allison As part of the TCP View project.
Advertisements

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.
1 Java Networking – Part I CS , Spring 2008/9.
Programming Applets How do Applets work ? This is an HTML page This is the applet’s code It has a link to an applet.
1 Overview r Socket programming with TCP r Socket programming with UDP r Building a Web server.
System Programming Practical session 10 Java sockets.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved L24 (Chapter 25) Networking.
Client/Server example. Server import java.io.*; import java.net.*; import java.util.*; public class PrimeServer { private ServerSocket sSoc; public static.
CIS – Spring Instructors: Geoffrey Fox, Bryan Carpenter Computational Science and.
Software Engineering Recitation 2 Suhit Gupta. Today we will be covering… XML II Sockets, Server – Client relationships, Servers capable of handling multiple.
Client/Server In Java An Introduction to TCP/IP and Sockets.
Projekt współfinansowany przez Unię Europejską w ramach Europejskiego Funduszu Społecznego „Networking”
28-Jun-15 Basic Protocols. 2 Sockets Sockets, or ports, are a very low level software construct that allows computers to talk to one another When you.
2: Application Layer1 Socket Programming. 2: Application Layer2 Socket-programming using TCP Socket: a door between application process and end- end-transport.
Welcome to CIS 235 Computer Networks Fall, 2007 Prof Peterson.
15-Jul-15 Basic Protocols. 2 Sockets Sockets, or ports, are a very low level software construct that allows computers to talk to one another When you.
CS 352-Socket Programming & Threads Dept. of Computer Science Rutgers University (Thanks,this slides taken from er06/
CS4273: Distributed System Technologies and Programming I Lecture 5: Java Socket Programming.
2: Application Layer1 Socket programming Socket API r introduced in BSD4.1 UNIX, 1981 r explicitly created, used, released by apps r client/server paradigm.
TCP/IP Protocol Suite 1 Chapter 22 Upon completion you will be able to: World Wide Web: HTTP Understand the components of a browser and a server Understand.
DBI Representation and Management of Data on the Internet.
Mark Fontenot CSE Honors Principles of Computer Science I Note Set 11.
School of Engineering and Computer Science Victoria University of Wellington Copyright: Peter Andreae david streader, VUW Echo Networking COMP
Practicum: - Client-Server Computing in Java Fundamental Data Structures and Algorithms Margaret Reid-Miller 13 April 2004.
Object Oriented Programming in Java Lecture 16. Networking in Java Concepts Technicalities in java.
Lecture 9 Network programming. Manipulating URLs URL is an acronym for Uniform Resource Locator and is a reference (an address) to a resource on the Internet.
1 Network Programming and Java Sockets. 2 Network Request Result a client, a server, and network Client Server Client machine Server machine Elements.
Networking with Java Socket programming. The Interweb thing Al Gore invented… Internet is a network of networks. The Internet is really people communicating.
OBJECT ORIENTED PROGRAMMING B.TECH II YR II SEMESTER(TERM 08-09) UNIT 8 PPT SLIDES TEXT BOOKS: 1. Java: the complete reference, 7th editon, Herbert schildt,
Web Design & Development 1 Lec - 21 Umair Javed. Web Design & Development 2 Socket Programming.
School of Engineering and Computer Science Victoria University of Wellington Copyright: Peter Andreae, VUW Networking COMP # 22.
Networks Sockets and Streams. TCP/IP in action server ports …65535 lower port numbers ( ) are reserved port echo7 time13 ftp20 telnet23.
 2003 Joel C. Adams. All Rights Reserved. Calvin CollegeDept of Computer Science(1/11) Java Sockets and Simple Networking Joel Adams and Jeremy Frens.
1 cs205: engineering software university of virginia fall 2006 Network Programming* * Just enough to make you dangerous Bill Cheswick’s map of the Internet.
CS390- Unix Programming Environment CS 390 Unix Programming Environment Java Socket Programming.
Networking Terminology: ISP (Internet service provider) – dialup, dsl, cable LAN (local area network) IP (internet protocol) address, eg
CSE S. Tanimoto Java Introduction 1 Java A Programming Language for Web-based Computing with Graphics.
2: Application Layer1 Chapter 2: Application layer r 2.1 Principles of network applications r 2.2 Web and HTTP r 2.3 FTP r 2.4 Electronic Mail  SMTP,
1 CSCD 330 Network Programming Spring 2014 Some Material in these slides from J.F Kurose and K.W. Ross All material copyright Lecture 7 Application.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Computer Networks & PROTOCOLS (CSI 4118) FALL 2005 Professor Robert L. Probert.
Java Server Programming Web Interface for Java Programs.
1 CSCD 330 Network Programming Some Material in these slides from J.F Kurose and K.W. Ross All material copyright Lecture 9 Client-Server Programming.
Part 4: Network Applications Client-server interaction, example applications.
27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
By Vivek Dimri. Basic Concepts on Networking IP Address – Protocol – Ports – The Client/Server Paradigm – Sockets The Java Networking Package – The InetAddress.
TCP/IP Protocol Stack IP Device Drivers TCPUDP Application Sockets (Gate to network) TCP: –Establish connection –Maintain connection during the communication.
1 COMP 431 Internet Services & Protocols Client/Server Computing & Socket Programming Jasleen Kaur February 2, 2016.
Java Programming II Java Network (I) Java Programming II.
1 Lecture 9: Network programming. 2 Manipulating URLs URL is an acronym for Uniform Resource Locator and is a reference (an address) to a resource on.
Networking Code CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
Spring/2002 Distributed Software Engineering C:\unocourses\4350\slides\DefiningThreads 1 Java API for distributed computing.
School of Engineering and Computer Science Victoria University of Wellington Copyright: Peter Andreae david streader, VUW Echo Networking COMP
CSE S. Tanimoto Java Introduction 1 Java A Programming Language for Web-based Computing.
Network Programming Communication between processes Many approaches:
Prepared by: Dr. Abdallah Mohamed, AOU-KW Unit9: Internet programming 1.
Java 13. Networking public class SumTest {
Network Programming in Java CS 1111 Ryan Layer May 3, 2010
CSE 341, S. Tanimoto Java networking-
Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
An Introduction to TCP/IP and Sockets
„Networking”.
CSI 4118 – UNIVERSITY OF OTTAWA
Introduction to Client/Server Design
Socket Programming 2: Application Layer.
Distributed Computing
Chapter 2: Application layer
Multiplexing/Demux.
CS18000: Problem Solving and Object-Oriented Programming
Presentation transcript:

CSE 341, S. Tanimoto Java networking- 1 Java Networking Motivation Network Layers Using Sockets A Tiny Server Applets URLs Downloading Images, MediaTracker

CSE 341, S. Tanimoto Java networking- 2 Motivation Support distributed model of computation Permit programs to download documents Permit programs to run as Applets Anticipate bandwidth limitations

CSE 341, S. Tanimoto Java networking- 3 Network Layers Application Level (FTP, Telnet, etc.) Transport Layer (TCP, UDP, sockets, etc.) Network Layer (Low-level Protocol -- IP, datagrams, etc.) Hardware Layer (Ethernet, TokenRing, X.25, etc.)

CSE 341, S. Tanimoto Java networking- 4 Sockets int port=2000; BufferedReader br; PrintWriter pw; ServerSocket ss; Socket sock; ss = new ServerSocket(port); sock = ss.accept(); br = new BufferedReader( new InputStreamReader( (sock.getInputStream()); pw = new PrintWriter( sock.getOutputStream()); System.out.println( br.readLine()); pw.println( " HELLO " ); int port=2000; String host= ” cubist " ; BufferedReader br; PrintWriter pw; Socket sock; sock = new Socket(host,port); br = new BufferedReader( new InputStreamReader( (sock.getInputStream()); pw = new PrintWriter( sock.getOutputStream()); pw.println( " ciao " ); System.out.println( br.readLine()); Server Client

CSE 341, S. Tanimoto Java networking- 5 A Tiny Server import java.net.*; import java.io.*; public class TestServer { static int port=2000; static BufferedReader br; static PrintWriter pw; static ServerSocket ss; static Socket sock; public static void main(String [] args) { try { ss = new ServerSocket(port); sock = ss.accept(); br = new BufferedReader(new InputStreamReader( (sock.getInputStream()))); pw = new PrintWriter(sock.getOutputStream()); System.out.println(br.readLine()); pw.println("HELLO"); } catch (IOException e) {System.out.println("Error connecting to port");} } }

CSE 341, S. Tanimoto Java networking- 6 Applets Developed to fit a W W W client/server architecture with fat clients Normally applets live “in the browser” Limited permissions (talk only to the hosting server, don’t touch local hard disk). Use applet context as an operating env’t.

CSE 341, S. Tanimoto Java networking- 7 URLs Uniform Resource Locator ftp://ftp.cs.washington.edu/pub/myprog.tar class URL URL u; String mydoc; try { u = new URL(" } catch (MalformedURLException e) { system.out.println("MalformedURLException for " + filename); return; } try { mydoc = (String) u.getContent(); } catch (IOException e) {}

CSE 341, S. Tanimoto Java networking- 8 Downloading Images Java anticipated the download times required to retrieve images. provides the MediaTracker class to keep track of the status of files that are being downloaded. Images can be retrieved with URLs that point to either JPEG or GIF images.

CSE 341, S. Tanimoto Java networking- 9 Other Networking Issues Distributed objects: Java serialization and class loaders Security: levels of trust/privileges, signed applets Robustness: Avoiding errors, handling errors Practical distribution of code and data: JAR files Reverse engineering and Intellectual Property protection