CS2 Advanced Programming in Java note 8

Size: px
Start display at page:

Download "CS2 Advanced Programming in Java note 8"

Transcription

1 CS2 Advanced Programming in Java note 8 Java and the Internet One of the reasons Java is so popular is because of the exciting possibilities it offers for exploiting the power of the Internet. On the one hand, it is easy to write self-contained programs (called applets) which can be embedded in Web pages. On the other hand, there are also facilities which make it easy for a program to communicate over the Internet with other programs running at the same time. In this note, we will briefly look at some of these possibilities. The first half of this note is closely based on Chapter 20 of Cornelius s book, which we recommend for a more detailed account of this material. 8.1 Embedding an applet in a Web page We have seen in a previous lecture how to use the graphical facilities provided by the Swing toolkit to create programs called applets. As we have seen, applets can be run and tested using the, but the main reason for creating an applet is to include it as part of a Web page. To do this, one simply has to insert a suitable piece of HTML at the appropriate point in the source file for your Web page, telling the user s Web browser where to find the Java class files for the applet, and how much space to allow for the applet panel. In the early days of the WWW, this could be done with a very simple piece of HTML such as! "# $% " '&)( * *,+.-/ / : 8 Unfortunately, however, as the WWW developed, things got more complicated: different browsers made use of slightly different variants of HTML and supporting different versions of Java, and it became harder to ensure that the same applet could be run on all browsers. The recommended solution nowadays is to include a more complicated and ugly piece of HTML which instructs the browser to download a plug-in to enable it to run the appropriate version of Java if this version is not already present on the computer. We will not bother to include the relevant piece of HTML here, but you may find it in the file ;< =>& $ in the Practical 8 directory. You do not really have to understand how it works to adapt it to your own applet, you typically only have to change the name of the Java class file and the values of the width and height parameters (and perhaps also the version of Java that your applet requires.) 1

2 Much of the complication stems from the fact that different Web browsers expect different things, so the HTML we use actually has to say many things twice once for the benefit of Netscape Navigator, and once for the benefit of Internet Explorer! (Note that in adapting the HTML you therefore have to change the filename and size parameters in two places.) An even more complicated version that can deal with even more situations is available from the Sun website at : : A B&)*DC "@&)(=D$ : <= E C(F * : FC# /". Unless otherwise stated in your HTML, the browser will look for the Java class file for the applet in the same directory as that in which the HTML source file itself is hosted. If the applet lives in some other directory, you can tell it where to look by changing the value of the ( =E G< <* attribute to the (relative) pathname of the directory where your class file lives. 8.2 Java Archive files Typically a Java program will involve several &)( ** files. If the approach outlined above is adopted, your HTML will refer only to the main class file for your program, and the web browser will download this only to discover that it needs other class files in order to run the program. This is rather inefficient as it tends to result in several HTTP connections, one for each class file needed. To overcome this problem, it is recommended that all the class files (and any other files the applet needs such as images and audio clips) be bundled together in a single Java Archive file, or & A file. For instance, to bundle together all the &)( * * files in the current directory, one can type something like AH(D I "# $%" '& A KJL&)( * * to the shell prompt. (See the online manual page for A for more details on this command.) To tell the Web browser to look for a & A file rather than a &)( ** file, we now have to add a couple more lines of HTML to set the %(/;./ < attribute. In connection with the M ND tag, we add the line O PQ P (/;./ SR T! "# $%" '& A 98 alongside the other lines of a similar form, and in connection with the PM we add the clause tag (/;./! "# A The use of a & A file means that all the files needed to run the program can be downloaded using a single HTTP connection. In addition, the A utility performs some compression on the files, which further improves download time. 2

3 8.3 The life cycle of an applet Finally, in order to write any code for an applet, one needs to be aware of the various stages that an applet can go through in its interaction with a web browser. Recall that the Java code for an applet takes the form of a class which inherits (directly or indirectly) from the API class JApplet, and which has a zero-argument constructor (which may be the default constructor if no other is provided). When the user first visits the web page containing the applet, the applet s bytecode is loaded into the browser, and a new object of this class is created using the zeroargument constructor. As usual when an object is created, this will typically mean that initial values are assigned to the object s fields, and the body of the constructor (if present) is executed. Next, the object s init method is executed, which may perform further initialization. After that, the object s start method is executed. Whereas the init method is only executed once when the applet is first loaded, the start method is re-executed whenever the user returns to the WWW page after having visited another page. Whenever the user leaves this page, the stop method is executed. Finally, the destroy method is executed if the WWW browser ever unloads the applet (for instance, to make room for another applet). The class JApplet itself has trivial versions of these four methods (which do nothing), but the programmer may override these with his or her own code to do whatever is required in each of these situations. For instance, the init and destroy methods might (respectively) open and close connections with the server (see below), or the start method might start some animation sequence. For many applets, it suffices to provide a simple init method. We should also mention the paint method which is called whenever the applet window has to be redrawn (e.g. immediately after the init and start methods are executed, or after the browser window has been moved or resized). As explained in a previous lecture, the programmer will typically wish to override the paint method with code to redraw the applet window s contents appropriately. Finally, a reminder that for security reasons, there are certain limitations on the operations that an applet can perform: typically it cannot read or write files on the machine it is running on, or establish connections with other computers apart from the server from which it was downloaded. (These limitations are special to applets and do not apply to Java programs in general.) This principle is often expressed by saying that applets are run within a sandbox Reading files over the Internet So far we have looked at applets which, although they can be transferred over the Internet, essentially run as self-contained programs. We will now look at some of the ways in which applets (and Java programs in general) can communicate with other machines over the Internet. 1 A safe play area for small children. When I was little we called this a sandpit. 3

4 We first consider how a program may read a file stored on another machine. We might wish to do this if we had a large repository of data files hosted on a server somewhere, and we wished to allow a program running on another machine to gain access to just the files that it needs, without downloading the entire repository. To read the contents of a data file stored anywhere on the Internet, one needs to know the URL for the file. In a Java program, URLs are represented by objects of the class java.net.url. There are a variety of constructors for this class: for instance, we may create an instance by saying something like URL stuffurl = new URL (" ) ; or, if dir is already the URL for a directory somewhere, we may construct the URL for a particular file in this directory by saying URL stuffurl = new URL (dir, "stuff.txt " ) ; We may then "open" the file in question to obtain an input stream, which we can manipulate just as if it were an input stream obtained from a file on the local machine, or one corresponding to input from the keyboard. As with keyboard input, a rather complex sequence of transformations is needed to get this stream into the most convenient form: BufferedReader stuffreader = new BufferedReader (new InputStreamReader (stuffurl.openstream())) ; We may then use methods for the class BufferedReader to read the contents of stuff.txt in the way that we require, e.g. a character at a time, or a line at a time. When we have finished with this file, we may execute stuffreader.close(). A Java application program may read a file in this way from a machine anywhere on the Internet. By contrast, an applet is only permitted to read files from the server on which the applet itself was hosted. One could of course write the appropriate URL for this server into the Java code itself, but it is much better to obtain this URL by calling the method getdocumentbase from the class java.applet.applet. This method returns the URL of the directory containing the &U; $ file for the Web page containing the applet. From this one may obtain the URL for the required file itself as e.g. URL stuffurl = new URL (getdocumentbase(), "stuff.txt") ; Another closely related method is getcodebase, which returns the URL of the directory containing the main Java class file for the applet. This will typically be the same as the URL given by getdocumentbase, unless the codebase attribute is explicitly been set to something else in the HTML as described above. Warning: The methods getdocumentbase and getcodebase should be called within the body of the init method for the applet. They do not seem to work if called within the body of the constructor or in field initialization expressions. 8.5 Client/server computing and sockets Although the machinery described above allows client programs to access large amounts of data stored on a single server, it is rather limited by the fact that 4

5 the data in question has to be static that is, stored in fixed, pre-existing files. For more interesting applications, we would like the dialogue between client and server to be more interactive in particular we would like to be able to communicate dynamic data that has been specially generated by a live program in response to a request from the client. (For example, consider a Webbased system which allows the user to find out the times of trains between two given stations around a given time.) Or we might want our server to administer communications between different clients (consider a Web-based multi-player adventure game). All these kinds of communication, and more, can be achieved very simply in Java using the API classes for sockets. Sockets provide a way in which a pair of processes can communicate. The two processes might be running on the same machine or on different machines. In general the processes need not be Java programs, but here we will restrict attention the case of a Java program communicating with another Java program. The basic paradigm is as follows. Each machine on the Internet has (conceptually at least) several thousand ports on which it can communicate, each identified by a number between 1 and Ports 1 to 1023 are typically reserved for system uses such as sending and receiving , but almost all the others are available for use by users. To establish a connection between two processes, one of the processes (which we call the server) needs to be already listening out for connection requests on some port; the other (which we call the client) then takes the initiative and calls up the server on this port to make a connection. More specifically, the server program first needs to create a server socket on a given port, using the constructor ServerSocket (int port). The server may then listen for a connection by calling the method accept () on this server socket. The accept method will wait until a connection is made, and will then create and return a new Socket object which the server may use to talk to the client. At any time, the server may close the server socket using the method close(), after which it will no longer be possible for new clients to initiate connections. Meanwhile, a client has created a client socket and connected it to the server on the given port using the constructor Socket (String host, int port) Here the host identifies the server it may be a name (such as "localhost" or " starfruit.dcs.ed.ac.uk ") or an IP address (such as " "). Assuming the server is listening for a connection at the time, this creates a socket on the client s side which he may use to talk to the server. We are now in a position where each party is in possession of a Socket object which he may use to talk to the other. All the actual communication happens using these sockets; the server socket only exists to allow connections to be set up. Now that the socket connection is in place, it can be used as a bidirectional communication channel. For both parties, the methods getinputstream() and getoutputstream() return the InputStream and OutputStream associated with the socket, and they can send and receive information on these streams (as a sequence of bytes) at any time, much as if they were writing to or reading from an 5

6 ordinary file. We will typically want to buffer these streams for efficiency, e.g. BufferedInputStream bis = new BufferedInputStream (sock.getinputstream()) ; At any time, either participant may close the connection by calling the method close() on their socket. Note that an applet may initiate a socket connection to the host from which the applet was downloaded, but not to any other machine. Furthermore, an applet may not set itself up as a server and accept socket connections from another machine. This probably gives you enough information to get started; further information can be found in the online documentation for the classes Socket and ServerSocket in the package java.net. In a sense, sockets provide a rather primitive or low-level form of communication in that they only allow the two parties to exchange data as raw bytes. In addition, Java has APIs that offer higher levels of abstraction for client-server computing, principally Remote Method Invocation (RMI) and Common Object Request Broker Architecture (CORBA). However, we will not go into these here, and in any case it is important first to understand of the socket level communication on which these technologies are based. John Longley,

Framework. Set of cooperating classes/interfaces. Example: Swing package is framework for problem domain of GUI programming

Framework. Set of cooperating classes/interfaces. Example: Swing package is framework for problem domain of GUI programming Frameworks 1 Framework Set of cooperating classes/interfaces Structure essential mechanisms of a problem domain Programmer can extend framework classes, creating new functionality Example: Swing package

More information

PROGRAMMING LANGUAGE 2

PROGRAMMING LANGUAGE 2 1 PROGRAMMING LANGUAGE 2 Lecture 13. Java Applets Outline 2 Applet Fundamentals Applet class Applet Fundamentals 3 Applets are small applications that are accessed on an Internet server, transported over

More information

Writing a Protocol Handler

Writing a Protocol Handler Writing a Protocol Handler A URL object uses a protocol handler to establish a connection with a server and perform whatever protocol is necessary to retrieve data. For example, an HTTP protocol handler

More information

Module 5 Applets About Applets Hierarchy of Applet Life Cycle of an Applet

Module 5 Applets About Applets Hierarchy of Applet Life Cycle of an Applet About Applets Module 5 Applets An applet is a little application. Prior to the World Wide Web, the built-in writing and drawing programs that came with Windows were sometimes called "applets." On the Web,

More information

Lab 10: Sockets 12:00 PM, Apr 4, 2018

Lab 10: Sockets 12:00 PM, Apr 4, 2018 CS18 Integrated Introduction to Computer Science Fisler, Nelson Lab 10: Sockets 12:00 PM, Apr 4, 2018 Contents 1 The Client-Server Model 1 1.1 Constructing Java Sockets.................................

More information

Module 5 The Applet Class, Swings. OOC 4 th Sem, B Div Prof. Mouna M. Naravani

Module 5 The Applet Class, Swings. OOC 4 th Sem, B Div Prof. Mouna M. Naravani Module 5 The Applet Class, Swings OOC 4 th Sem, B Div 2016-17 Prof. Mouna M. Naravani The HTML APPLET Tag An applet viewer will execute each APPLET tag that it finds in a separate window, while web browsers

More information

Introduction to Java.net Package. CGS 3416 Java for Non Majors

Introduction to Java.net Package. CGS 3416 Java for Non Majors Introduction to Java.net Package CGS 3416 Java for Non Majors 1 Package Overview The package java.net contains class and interfaces that provide powerful infrastructure for implementing networking applications.

More information

Today. cisc3120-fall2012-parsons-lectiv.2 2

Today. cisc3120-fall2012-parsons-lectiv.2 2 NETWORK PROGRAMMING Today Today we will start to look at ways to write programs that operate over the network. We ll lok at two approaches that are supported by Java: Applets Socket-based communication

More information

CS 2113 Software Engineering

CS 2113 Software Engineering CS 2113 Software Engineering Java 6: File and Network IO https://github.com/cs2113f18/template-j-6-io.git Professor Tim Wood - The George Washington University Project 2 Zombies Basic GUI interactions

More information

(Refer Slide Time: 02:01)

(Refer Slide Time: 02:01) Internet Technology Prof. Indranil Sengupta Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture No #29 Java Applets Part: 2 In this lecture we shall be continuing

More information

Lecture 11.1 I/O Streams

Lecture 11.1 I/O Streams 21/04/2014 Ebtsam AbdelHakam 1 OBJECT ORIENTED PROGRAMMING Lecture 11.1 I/O Streams 21/04/2014 Ebtsam AbdelHakam 2 Outline I/O Basics Streams Reading characters and string 21/04/2014 Ebtsam AbdelHakam

More information

PIC 20A Streams and I/O

PIC 20A Streams and I/O PIC 20A Streams and I/O Ernest Ryu UCLA Mathematics Last edited: December 7, 2017 Why streams? Often, you want to do I/O without paying attention to where you are reading from or writing to. You can read

More information

INTRODUCTION TO COMPUTER PROGRAMMING. Richard Pierse. Class 9: Writing Java Applets. Introduction

INTRODUCTION TO COMPUTER PROGRAMMING. Richard Pierse. Class 9: Writing Java Applets. Introduction INTRODUCTION TO COMPUTER PROGRAMMING Richard Pierse Class 9: Writing Java Applets Introduction Applets are Java programs that execute within HTML pages. There are three stages to creating a working Java

More information

Distributed Systems COMP 212. Lecture 8 Othon Michail

Distributed Systems COMP 212. Lecture 8 Othon Michail Distributed Systems COMP 212 Lecture 8 Othon Michail HTTP Protocol Hypertext Transfer Protocol Used to transmit resources on the WWW HTML files, image files, query results, Identified by Uniform Resource

More information

IT6503 WEB PROGRAMMING. Unit-I

IT6503 WEB PROGRAMMING. Unit-I Department of Information Technology Question Bank- Odd Semester 2015-2016 IT6503 WEB PROGRAMMING Unit-I SCRIPTING 1. What is HTML? Write the format of HTML program. 2. Differentiate HTML and XHTML. 3.

More information

Unit 9: Network Programming

Unit 9: Network Programming Faculty of Computer Science Programming Language 2 Object oriented design using JAVA Dr. Ayman Ezzat Email: ayman@fcih.net Web: www.fcih.net/ayman Unit 9: Network Programming 1 1. Background 2. Accessing

More information

Info 408 Distributed Applications programming 2 nd semester of 2017/2018 Credits: 5 Lecturer: Dr. Antoun Yaacoub

Info 408 Distributed Applications programming 2 nd semester of 2017/2018 Credits: 5 Lecturer: Dr. Antoun Yaacoub Lebanese University Faculty of Science I Master 1 degree Computer Science Info 408 Distributed Applications programming 2 nd semester of 2017/2018 Credits: 5 Lecturer: Dr. Antoun Yaacoub Starting Network

More information

MULTIMEDIA PROGRAMMING IN JAVA. Prof.Asoc. Alda Kika Department of Informatics Faculty of Natural Sciences University of Tirana

MULTIMEDIA PROGRAMMING IN JAVA. Prof.Asoc. Alda Kika Department of Informatics Faculty of Natural Sciences University of Tirana MULTIMEDIA PROGRAMMING IN JAVA Prof.Asoc. Alda Kika Department of Informatics Faculty of Natural Sciences University of Tirana Objectives Applets in Java Getting, displaying and scaling the image How to

More information

An applet is a program written in the Java programming language that can be included in an HTML page, much in the same way an image is included in a

An applet is a program written in the Java programming language that can be included in an HTML page, much in the same way an image is included in a CBOP3203 An applet is a program written in the Java programming language that can be included in an HTML page, much in the same way an image is included in a page. When you use a Java technology-enabled

More information

SELF-STUDY. Glossary

SELF-STUDY. Glossary SELF-STUDY 231 Glossary HTML (Hyper Text Markup Language - the language used to code web pages) tags used to embed an applet. abstract A class or method that is incompletely defined,

More information

ROEVER ENGINEERING COLLEGE Elambalur,Perambalur DEPARTMENT OF CSE

ROEVER ENGINEERING COLLEGE Elambalur,Perambalur DEPARTMENT OF CSE ROEVER ENGINEERING COLLEGE Elambalur,Perambalur-621212 DEPARTMENT OF CSE 2 marks questions with answers CS331-ADVANCED JAVA PROGRAMMING 1. What is Java Streaming? Java streaming is nothing more than a

More information

Programming In Java Prof. Debasis Samanta Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

Programming In Java Prof. Debasis Samanta Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Programming In Java Prof. Debasis Samanta Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture - 06 Demonstration II So, in the last lecture, we have learned

More information

CT 229 Arrays in Java

CT 229 Arrays in Java CT 229 Arrays in Java 27/10/2006 CT229 Next Weeks Lecture Cancelled Lectures on Friday 3 rd of Nov Cancelled Lab and Tutorials go ahead as normal Lectures will resume on Friday the 10 th of Nov 27/10/2006

More information

Java Support for developing TCP Network Based Programs

Java Support for developing TCP Network Based Programs Java Support for developing TCP Network Based Programs 1 How to Write a Network Based Program (In Java) As mentioned, we will use the TCP Transport Protocol. To communicate over TCP, a client program and

More information

Java History. Java History (cont'd)

Java History. Java History (cont'd) Java History Created by James Gosling et. al. at Sun Microsystems in 1991 "The Green Team" Investigate "convergence" technologies Gosling created a processor-independent language for StarSeven, a 2-way

More information

CHAPTER 7 WEB SERVERS AND WEB BROWSERS

CHAPTER 7 WEB SERVERS AND WEB BROWSERS CHAPTER 7 WEB SERVERS AND WEB BROWSERS Browser INTRODUCTION A web browser is a software application for retrieving, presenting, and traversing information resources on the World Wide Web. An information

More information

ASSIGNMENT NO 14. Objectives: To learn and demonstrated use of applet and swing components

ASSIGNMENT NO 14. Objectives: To learn and demonstrated use of applet and swing components Create an applet with three text Fields and four buttons add, subtract, multiply and divide. User will enter two values in the Text Fields. When any button is pressed, the corresponding operation is performed

More information

Lecture 3: Socket Programming

Lecture 3: Socket Programming Lecture 3: Socket Programming Prof. Shervin Shirmohammadi SITE, University of Ottawa Fall 2005 CEG4183/ELG4183 3-1 Sockets From a logical perspective, a Socket is a communication end point. It is not a

More information

Outline. Introduction to Java. What Is Java? History. Java 2 Platform. Java 2 Platform Standard Edition. Introduction Java 2 Platform

Outline. Introduction to Java. What Is Java? History. Java 2 Platform. Java 2 Platform Standard Edition. Introduction Java 2 Platform Outline Introduction to Java Introduction Java 2 Platform CS 3300 Object-Oriented Concepts Introduction to Java 2 What Is Java? History Characteristics of Java History James Gosling at Sun Microsystems

More information

Java Applets. Last Time. Java Applets. Java Applets. First Java Applet. Java Applets. v We created our first Java application

Java Applets. Last Time. Java Applets. Java Applets. First Java Applet. Java Applets. v We created our first Java application Last Time v We created our first Java application v What are the components of a basic Java application? v What GUI component did we use in the examples? v How do we write to the standard output? v An

More information

OBJECT ORIENTED PROGRAMMING

OBJECT ORIENTED PROGRAMMING 1 OBJECT ORIENTED PROGRAMMING Lecture 14 Networking Basics Outline 2 Networking Basics Socket IP Address DNS Client/Server Networking Class & Interface URL Demonstrating URL Networking 3 Java is practically

More information

Supporting Materials

Supporting Materials Preface p. xxiii Introduction p. xxiii Key Features p. xxiii Chapter Outlines p. xxiv Supporting Materials p. xxvi Acknowledgments p. xxvii Java Fundamentals p. 1 Bits, Bytes, and Java p. 2 The Challenge

More information

Contents 8-1. Copyright (c) N. Afshartous

Contents 8-1. Copyright (c) N. Afshartous Contents 1. Classes and Objects 2. Inheritance 3. Interfaces 4. Exceptions and Error Handling 5. Intro to Concurrency 6. Concurrency in Java 7. Graphics and Animation 8. Applets 8-1 Chapter 8: Applets

More information

Chapter 13. Applets and HTML. HTML Applets. Chapter 13 Java: an Introduction to Computer Science & Programming - Walter Savitch 1

Chapter 13. Applets and HTML. HTML Applets. Chapter 13 Java: an Introduction to Computer Science & Programming - Walter Savitch 1 Chapter 13 Applets and HTML HTML Applets Chapter 13 Java: an Introduction to Computer Science & Programming - Walter Savitch 1 Overview Applets: Java programs designed to run from a document on the Internet

More information

Road Map. Introduction to Java Applets Review applets that ship with JDK Make our own simple applets

Road Map. Introduction to Java Applets Review applets that ship with JDK Make our own simple applets Java Applets Road Map Introduction to Java Applets Review applets that ship with JDK Make our own simple applets Introduce inheritance Introduce the applet environment html needed for applets Reading:

More information

CSCD 330 Network Programming Spring 2018

CSCD 330 Network Programming Spring 2018 CSCD 330 Network Programming Spring 2018 Lecture 6 Application Layer Socket Programming in Java Reading for Java Client/Server see Relevant Links Some Material in these slides from J.F Kurose and K.W.

More information

CMPE 150/L : Introduction to Computer Networks. Chen Qian Computer Engineering UCSC Baskin Engineering Lecture 4

CMPE 150/L : Introduction to Computer Networks. Chen Qian Computer Engineering UCSC Baskin Engineering Lecture 4 CMPE 150/L : Introduction to Computer Networks Chen Qian Computer Engineering UCSC Baskin Engineering Lecture 4 1 Lab schedule confirmation Mondays, 12:00-2:00pm Tuesdays, 11:00am-1:00pm Wednesdays, 4:00-6:00pm

More information

Media Tools in Canvas

Media Tools in Canvas Media Tools in Canvas 12/2017 Definition of Media Tools Media tools include any feature in Canvas that facilitates in creating or accessing images and audio or video material, as well as any feature in

More information

Chapter 7 Applets. Answers

Chapter 7 Applets. Answers Chapter 7 Applets Answers 1. D The drawoval(x, y, width, height) method of graphics draws an empty oval within a bounding box, and accepts 4 int parameters. The x and y coordinates of the left/top point

More information

(Refer Slide Time: 01:40)

(Refer Slide Time: 01:40) Internet Technology Prof. Indranil Sengupta Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture No #25 Javascript Part I Today will be talking about a language

More information

1 What is Java? 2 Java is platform independent 3 Applets can be distributed by WWW 4 Example of an applet 5 The Java Language 6 Java is secure 7 Java in four versions 8 Java standard library 9 Event handling

More information

SRM ARTS AND SCIENCE COLLEGE SRM NAGAR, KATTANKULATHUR

SRM ARTS AND SCIENCE COLLEGE SRM NAGAR, KATTANKULATHUR SRM ARTS AND SCIENCE COLLEGE SRM NAGAR, KATTANKULATHUR 603203 DEPARTMENT OF COMPUTER SCIENCE & APPLICATIONS QUESTION BANK (2017-2018) Course / Branch : M.Sc.,CST Semester / Year : EVEN / III Subject Name

More information

Software Paradigms (Lesson 10) Selected Topics in Software Architecture

Software Paradigms (Lesson 10) Selected Topics in Software Architecture Software Paradigms (Lesson 10) Selected Topics in Software Architecture Table of Contents 1 World-Wide-Web... 2 1.1 Basic Architectural Solution... 2 1.2 Designing WWW Applications... 7 2 CORBA... 11 2.1

More information

Compaq Interview Questions And Answers

Compaq Interview Questions And Answers Part A: Q1. What are the difference between java and C++? Java adopts byte code whereas C++ does not C++ supports destructor whereas java does not support. Multiple inheritance possible in C++ but not

More information

HTML Links Tutorials http://www.htmlcodetutorial.com/ http://www.w3.org/markup/guide/ Quick Reference http://werbach.com/barebones/barebones.html Applets A Java application is a stand-alone program with

More information

Dynamic code downloading using Java TM (Using the java.rmi.server.codebase Property)

Dynamic code downloading using Java TM (Using the java.rmi.server.codebase Property) Pagina 1 Dynamic code downloading using Java TM RMI (Using the java.rmi.server.codebase Property) This tutorial is organized as follows: 1. Starting out 2. What is a codebase? 3. How does it work? 4. Using

More information

Networking and socket communica2on

Networking and socket communica2on Networking and socket communica2on CSCI 136: Fundamentals of Computer Science II Keith Vertanen Copyright 2014 Networking basics Overview Difference between: clients and servers Addressing IP addresses,

More information

Internet Application Developer

Internet Application Developer Internet Application Developer SUN-Java Programmer Certification Building a Web Presence with XHTML & XML 5 days or 12 evenings $2,199 CBIT 081 J A V A P R O G R A M M E R Fundamentals of Java and Object

More information

Outlines. Networking in Java. Internet hardware structure. Networking Diagram. IP Address. Networking in Java. Networking basics

Outlines. Networking in Java. Internet hardware structure. Networking Diagram. IP Address. Networking in Java. Networking basics G52APR Application programming Networking in Java Michael Li http://www.cs.nott.ac.uk/~jwl/g52apr Outlines Networking basics Network architecture IP address and port Server-client model TCP and UDP protocol

More information

Documentation (and midterm review)

Documentation (and midterm review) Documentation (and midterm review) Comp-303 : Programming Techniques Lecture 13 Alexandre Denault Computer Science McGill University Winter 2004 February 16, 2004 Lecture 13 Comp 303 : Programming Techniques

More information

Module 5 The Applet Class, Swings. OOC 4 th Sem, B Div Prof. Mouna M. Naravani

Module 5 The Applet Class, Swings. OOC 4 th Sem, B Div Prof. Mouna M. Naravani Module 5 The Applet Class, Swings OOC 4 th Sem, B Div 2017-18 Prof. Mouna M. Naravani The Applet Class Types of Applets (Abstract Window Toolkit) Offers richer and easy to use interface than AWT. An Applet

More information

Workbook A dialog box will appear asking for you to select your "workspace". Leave the default as is, which should be /home/crsid/workspace.

Workbook A dialog box will appear asking for you to select your workspace. Leave the default as is, which should be /home/crsid/workspace. In this workbook you will learn how to use Eclipse as a development environment for Java programs. Using Eclipse, you will then write a simple Java messaging client which will allow you to send and receive

More information

CS 10: Problem solving via Object Oriented Programming. Client/Server

CS 10: Problem solving via Object Oriented Programming. Client/Server CS 10: Problem solving via Object Oriented Programming Client/Server Agenda 1. Sockets 2. Server 3. MulAthreaded server 4. Chat server 2 Sockets are a way for computers to communicate IP: 1.2.3.4 HTTP

More information

Unit 1- Java Applets. Applet Programming. Local Applet and Remote Applet ** Applet and Application

Unit 1- Java Applets. Applet Programming. Local Applet and Remote Applet ** Applet and Application Applet Programming Applets are small Java applications that can be accessed on an Internet server, transported over Internet, and can be automatically installed and run as a part of a web document. An

More information

Software Development & Education Center. Java Platform, Standard Edition 7 (JSE 7)

Software Development & Education Center. Java Platform, Standard Edition 7 (JSE 7) Software Development & Education Center Java Platform, Standard Edition 7 (JSE 7) Detailed Curriculum Getting Started What Is the Java Technology? Primary Goals of the Java Technology The Java Virtual

More information

1 OBJECT-ORIENTED PROGRAMMING 1

1 OBJECT-ORIENTED PROGRAMMING 1 PREFACE xvii 1 OBJECT-ORIENTED PROGRAMMING 1 1.1 Object-Oriented and Procedural Programming 2 Top-Down Design and Procedural Programming, 3 Problems with Top-Down Design, 3 Classes and Objects, 4 Fields

More information

Module 5 The Applet Class, Swings. OOC 4 th Sem, B Div Prof. Mouna M. Naravani

Module 5 The Applet Class, Swings. OOC 4 th Sem, B Div Prof. Mouna M. Naravani Module 5 The Applet Class, Swings OOC 4 th Sem, B Div 2016-17 Prof. Mouna M. Naravani The Applet Class Types of Applets (Abstract Window Toolkit) Offers richer and easy to use interface than AWT. An Applet

More information

SRM ARTS AND SCIENCE COLLEGE SRM NAGAR, KATTANKULATHUR

SRM ARTS AND SCIENCE COLLEGE SRM NAGAR, KATTANKULATHUR SRM ARTS AND SCIENCE COLLEGE SRM NAGAR, KATTANKULATHUR 603203 DEPARTMENT OF COMPUTER SCIENCE & APPLICATIONS QUESTION BANK (2017-2018) Course / Branch : MCA Semester / Year : EVEN / II Subject Name : Programming

More information

Sockets and RMI. CS151 Chris Pollett Dec. 5, 2005.

Sockets and RMI. CS151 Chris Pollett Dec. 5, 2005. Sockets and RMI CS151 Chris Pollett Dec. 5, 2005. Outline Echo Server with Multiple Clients Client pull/server push Remote Method Invocation Proxy Pattern Echo Server with Multiple Clients public class

More information

Internet Technology 2/7/2013

Internet Technology 2/7/2013 Sample Client-Server Program Internet Technology 02r. Programming with Sockets Paul Krzyzanowski Rutgers University Spring 2013 To illustrate programming with TCP/IP sockets, we ll write a small client-server

More information

Lecture 22. Java Input/Output (I/O) Streams. Dr. Martin O Connor CA166

Lecture 22. Java Input/Output (I/O) Streams. Dr. Martin O Connor CA166 Lecture 22 Java Input/Output (I/O) Streams Dr. Martin O Connor CA166 www.computing.dcu.ie/~moconnor Topics I/O Streams Writing to a Stream Byte Streams Character Streams Line-Oriented I/O Buffered I/O

More information

Chapter 4: Processes

Chapter 4: Processes Chapter 4: Processes Process Concept Process Scheduling Operations on Processes Cooperating Processes Interprocess Communication Communication in Client-Server Systems 4.1 Process Concept An operating

More information

High Performance Computing Prof. Matthew Jacob Department of Computer Science and Automation Indian Institute of Science, Bangalore

High Performance Computing Prof. Matthew Jacob Department of Computer Science and Automation Indian Institute of Science, Bangalore High Performance Computing Prof. Matthew Jacob Department of Computer Science and Automation Indian Institute of Science, Bangalore Module No # 09 Lecture No # 40 This is lecture forty of the course on

More information

COMP 213. Advanced Object-oriented Programming. Lecture 20. Network Programming

COMP 213. Advanced Object-oriented Programming. Lecture 20. Network Programming COMP 213 Advanced Object-oriented Programming Lecture 20 Network Programming Network Programming A network consists of several computers connected so that data can be sent from one to another. Network

More information

9. APPLETS AND APPLICATIONS

9. APPLETS AND APPLICATIONS 9. APPLETS AND APPLICATIONS JAVA PROGRAMMING(2350703) The Applet class What is an Applet? An applet is a Java program that embedded with web content(html) and runs in a Web browser. It runs inside the

More information

CS18000: Programming I

CS18000: Programming I CS18000: Programming I File I/O 22 March, 2010 Prof. Chris Clifton Goal: Make Data Useful Beyond Program Execution Program data stored in variables Okay, a little more than that Arrays Linked data structures

More information

Vipera OTA Provisioning Server

Vipera OTA Provisioning Server Vipera Inc 200 Page Mill Road Palo Alto, CA 94306. USA www.vipera.com info@vipera.com Vipera OTA Provisioning Server Technical Overview Version 1.0 The Vipera provisioning portal allows content providers

More information

CC755: Distributed and Parallel Systems

CC755: Distributed and Parallel Systems CC755: Distributed and Parallel Systems Dr. Manal Helal, Spring 2016 moodle.manalhelal.com Lecture 7: Remote Method Invocation (RMI) 1 RMI Y Daniel Liang, Introduction to JAVA Programming, 9th Edition,

More information

Contents. iii Copyright 1998 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services August 1998, Revision B

Contents. iii Copyright 1998 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services August 1998, Revision B Contents About the Course...xv Course Overview... xvi Course Map... xvii Module-by-Module Overview... xviii Course Objectives... xxii Skills Gained by Module... xxiii Guidelines for Module Pacing... xxiv

More information

(Refer Slide Time: 1:09)

(Refer Slide Time: 1:09) Computer Networks Prof. S. Ghosh Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecturer # 30 UDP and Client Server Good day, today we will start our discussion

More information

Introduction to Dreamweaver

Introduction to Dreamweaver COMMUNITY TECHNICAL SUPPORT Introduction to Dreamweaver What is Dreamweaver? Dreamweaver helps you to create Web pages while it codes html (and more) for you. It is located on the bottom tray or in the

More information

Summary. 962 Chapter 23 Applets and Java Web Start

Summary. 962 Chapter 23 Applets and Java Web Start 962 Chapter 23 Applets and Java Web Start Summary Section 23.1 Introduction Applets (p. 942) are Java programs that are typically embedded in HTML (Extensible Hyper- Text Markup Language) documents also

More information

CS 209 Programming in Java #12 JAR Files: Creation and Use

CS 209 Programming in Java #12 JAR Files: Creation and Use CS 209 Programming in Java #12 JAR Files: Creation and Use Textbook Chapter 14 Spring, 2006 Instructor: J.G. Neal 1 Topics Introduction to JAR Files Using the JAR Tool for an Applet Deploying an Applet

More information

CS 209 Spring, 2006 Lab 12: JAR Files Instructor: J.G. Neal

CS 209 Spring, 2006 Lab 12: JAR Files Instructor: J.G. Neal CS 209 Spring, 2006 Lab 12: JAR Files Instructor: J.G. Neal Objectives: To gain experience with the creation and use of JAR files, particularly for an applet. Notes: 1. This lab exercise corresponds to

More information

Applets as front-ends to server-side programming

Applets as front-ends to server-side programming Applets as front-ends to server-side programming Objectives Introduce applets Examples of Java graphical programming How-to put an applet in a HTML page The HTML Applet tag and alternatives Applet communication

More information

Using SAS Enterprise Guide with the WIK

Using SAS Enterprise Guide with the WIK Using SAS Enterprise Guide with the WIK Philip Mason, Wood Street Consultants Ltd, United Kingdom ABSTRACT Enterprise Guide provides an easy to use interface to SAS software for users to create reports

More information

CS211 Lecture: Design Quality; Cohesion and Coupling; Packages

CS211 Lecture: Design Quality; Cohesion and Coupling; Packages CS211 Lecture: Design Quality; Cohesion and Coupling; Packages Objectives: Last revised October 4, 2004 1. To introduce the notion of design quality, tradeoffs, and some principles of quality design 2.

More information

[Course Overview] After completing this module you are ready to: Develop Desktop applications, Networking & Multi-threaded programs in java.

[Course Overview] After completing this module you are ready to: Develop Desktop applications, Networking & Multi-threaded programs in java. [Course Overview] The Core Java technologies and application programming interfaces (APIs) are the foundation of the Java Platform, Standard Edition (Java SE). They are used in all classes of Java programming,

More information

Authoring and Maintaining of Educational Applications on the Web

Authoring and Maintaining of Educational Applications on the Web Authoring and Maintaining of Educational Applications on the Web Denis Helic Institute for Information Processing and Computer Supported New Media ( IICM ), Graz University of Technology Graz, Austria

More information

G51PRG: Introduction to Programming Second semester Applets and graphics

G51PRG: Introduction to Programming Second semester Applets and graphics G51PRG: Introduction to Programming Second semester Applets and graphics Natasha Alechina School of Computer Science & IT nza@cs.nott.ac.uk Previous two lectures AWT and Swing Creating components and putting

More information

Topics. Java arrays. Definition. Data Structures and Information Systems Part 1: Data Structures. Lecture 3: Arrays (1)

Topics. Java arrays. Definition. Data Structures and Information Systems Part 1: Data Structures. Lecture 3: Arrays (1) Topics Data Structures and Information Systems Part 1: Data Structures Michele Zito Lecture 3: Arrays (1) Data structure definition: arrays. Java arrays creation access Primitive types and reference types

More information

Methods (Deitel chapter 6)

Methods (Deitel chapter 6) Methods (Deitel chapter 6) 1 Plan 2 Introduction Program Modules in Java Math-Class Methods Method Declarations Argument Promotion Java API Packages Random-Number Generation Scope of Declarations Methods

More information

CS506 Web Programming and Development Solved Subjective Questions With Reference For Final Term Lecture No 1

CS506 Web Programming and Development Solved Subjective Questions With Reference For Final Term Lecture No 1 P a g e 1 CS506 Web Programming and Development Solved Subjective Questions With Reference For Final Term Lecture No 1 Q1 Describe some Characteristics/Advantages of Java Language? (P#12, 13, 14) 1. Java

More information

Introduction to Computer Science I

Introduction to Computer Science I Introduction to Computer Science I Graphics Janyl Jumadinova 7 February, 2018 Graphics Graphics can be simple or complex, but they are just data like a text document or sound. Java is pretty good at graphics,

More information

WWW and Web Browser. 6.1 Objectives In this chapter we will learn about:

WWW and Web Browser. 6.1 Objectives In this chapter we will learn about: WWW and Web Browser 6.0 Introduction WWW stands for World Wide Web. WWW is a collection of interlinked hypertext pages on the Internet. Hypertext is text that references some other information that can

More information

Command-Line Applications. GUI Libraries GUI-related classes are defined primarily in the java.awt and the javax.swing packages.

Command-Line Applications. GUI Libraries GUI-related classes are defined primarily in the java.awt and the javax.swing packages. 1 CS257 Computer Science I Kevin Sahr, PhD Lecture 14: Graphical User Interfaces Command-Line Applications 2 The programs we've explored thus far have been text-based applications A Java application is

More information

Pieter van den Hombergh Richard van den Ham. March 17, 2018

Pieter van den Hombergh Richard van den Ham. March 17, 2018 : Network : Network, Object Pieter van den Hombergh Richard van den Ham Fontys Hogeschool voor Techniek en Logistiek March 17, 2018 /FHTenL : Network March 17, 2018 1/21 Topics, Object Some everyday life

More information

Chapter 3 - Introduction to Java Applets

Chapter 3 - Introduction to Java Applets 1 Chapter 3 - Introduction to Java Applets 2 Introduction Applet Program that runs in appletviewer (test utility for applets) Web browser (IE, Communicator) Executes when HTML (Hypertext Markup Language)

More information

CS335 Graphics and Multimedia

CS335 Graphics and Multimedia CS335 Graphics and Multimedia Fuhua (Frank) Cheng Department of Computer Science University of Kentucky Lexington, KY 40506-0046 -2-1. Programming Using JAVA JAVA history: WHY JAVA? Simple Objected-oriented

More information

P2: Collaborations. CSE 335, Spring 2009

P2: Collaborations. CSE 335, Spring 2009 P2: Collaborations CSE 335, Spring 2009 Milestone #1 due by Thursday, March 19 at 11:59 p.m. Completed project due by Thursday, April 2 at 11:59 p.m. Objectives Develop an application with a graphical

More information

Lecture Static Methods and Variables. Static Methods

Lecture Static Methods and Variables. Static Methods Lecture 15.1 Static Methods and Variables Static Methods In Java it is possible to declare methods and variables to belong to a class rather than an object. This is done by declaring them to be static.

More information

Middleware. Adapted from Alonso, Casati, Kuno, Machiraju Web Services Springer 2004

Middleware. Adapted from Alonso, Casati, Kuno, Machiraju Web Services Springer 2004 Middleware Adapted from Alonso, Casati, Kuno, Machiraju Web Services Springer 2004 Outline Web Services Goals Where do they come from? Understanding middleware Middleware as infrastructure Communication

More information

Web Server Project. Tom Kelliher, CS points, due May 4, 2011

Web Server Project. Tom Kelliher, CS points, due May 4, 2011 Web Server Project Tom Kelliher, CS 325 100 points, due May 4, 2011 Introduction (From Kurose & Ross, 4th ed.) In this project you will develop a Web server in two steps. In the end, you will have built

More information

File Input/Output. Introduction to Computer Science I. Overview (1): Overview (2): CSE 1020 Summer Bill Kapralos. Bill Kapralos.

File Input/Output. Introduction to Computer Science I. Overview (1): Overview (2): CSE 1020 Summer Bill Kapralos. Bill Kapralos. File Input/Output Tuesday, July 25 2006 CSE 1020, Summer 2006, Overview (1): Before We Begin Some administrative details Some questions to consider The Class Object What is the Object class? File Input

More information

CSCI S-Q Lecture #12 7/29/98 Data Structures and I/O

CSCI S-Q Lecture #12 7/29/98 Data Structures and I/O CSCI S-Q Lecture #12 7/29/98 Data Structures and I/O Introduction The WRITE and READ ADT Operations Case Studies: Arrays Strings Binary Trees Binary Search Trees Unordered Search Trees Page 1 Introduction

More information

Java Security. A Brief Introduction. Fred Long. The University of Wales, Aberystwyth UK. U.W. Aberystwyth CS25610/CHM5610. Java Security p.

Java Security. A Brief Introduction. Fred Long. The University of Wales, Aberystwyth UK. U.W. Aberystwyth CS25610/CHM5610. Java Security p. Java Security A Brief Introduction Fred Long The University of Wales, Aberystwyth UK Java Security p.1/24 Some Books Java Security, by Scott Oaks, O Reilly, 2nd edition, 2001. Inside Java 2 Platform Security,

More information

Networking. Lecture 25 ish? COP 3252 Summer July 11, 2017

Networking. Lecture 25 ish? COP 3252 Summer July 11, 2017 Networking Lecture 25 ish? COP 3252 Summer 2017 July 11, 2017 Open-Read/Write-Close The Unix I/O system follows a paradigm usually referred to as Open-Read/Write-Close. Before a program/process can perform

More information

CS 11 java track: lecture 6

CS 11 java track: lecture 6 CS 11 java track: lecture 6 This week: networking basics Sockets Vectors parsing strings what is networking? the network: world-wide web of interconnected computers "the internet" networking: programming

More information

Socket programming. Complement for the programming assignment INFO-0010

Socket programming. Complement for the programming assignment INFO-0010 Socket programming Complement for the programming assignment INFO-0010 Outline Socket definition Briefing on the Socket API A simple example in Java Multi-threading and Synchronization Example : HTTP protocol

More information