CSS 533 Program 2: Distributed Java Space Servers Professor: Munehiro Fukuda Due date: see the syllabus
|
|
- Eunice Evans
- 5 years ago
- Views:
Transcription
1 CSS 533 Program 2: Distributed Java Space Servers Professor: Munehiro Fukuda Due date: see the syllabus 1. Purpose This assignment implements a collection of distributed Java Space servers, which exercises how to launch remote processes through JSCH, how to multicast a UDP message, and how to implement distributed hash tables. 2. Concept of Distributed Java Space Servers As shown in the figure below, we assume that there are one server administrator and multiple client users. Our distributed Java Space servers, (simply called JSpace servers) run in the master-slave model. The server administrator starts the master JSpace server that launches a slave server at each of remote computing nodes, using the JSCH (secured ssh connection) library. java -cp jsch jar:jspace.jar JSpace.Server config.txt Entry( int, var2, 20 ) Entry( int, var1, 10 ) Jspace.Server Jsch connection show and quit command Multicast an entry (write) Jspace.Client Client 1 uw uw Jspace.Server Jspace.Server Server admin uw uw Multicast an entry (read/take) Jspace.Client Jspace.Server A UDP response Client 2 Entry( double, var1, 10.0 ) uw uw Multicast Group :50763
2 Note that config.txt includes the administrator s account, multicast group IP, port, and all slave IP address information as seen in Lab 3. Upon a slave server initialization, the master should send the following information to the slave: (1) Multicast group IP (2) Port (3) # of servers (including the master), say N (4) Server ID (where the master receives 0 and slaves are identified with 1 through to N 1) Each server including the master creates a local hash table to maintain user data items, (each packetized in an Entry object). For simplicity, we focus on only eight data types for Entry objects: byte, char, short, int, long, float, double, and java.lang.string. The way to store which entry into which server is up to your implementation, however the same entry should not be duplicated over multiple servers. In the key answer, each server maintains entries with the same data type. For instance, server 0 takes care of bytes and saver 1 handles chars. Once all servers are booted up, the server administrator can type in show or quit from the keyboard, each then sent through JSCH connections to all the slaves. All the servers including the master must respond to each command as follows: (1) show: each slave server sends its local hash table contents back to the master, whereas the master server displays all these hash table contents including its own to the administrator s monitor. (2) quit: all slave servers acknowledge to the master, upon which they all terminate themselves. JSpace client users can send write, read, and take operations to distributed servers through UDP multicast whose group IP and port should be the same as what the servers are using. For example, a write request can be coded as follows: 1: public class Writer { 2: private final static String multicast_group = " "; 3: private final static int port = 50763; 4: 5: public class Data extends JSpace.Entry { 6: public double variable = ; // a value to write 7: public void printval( ) { 8: System.out.println( variable ); 9: 10: 11: / 12: This constructor instantiates a JavaSpace client and a data entry, 13: thereafter access the space to write a double value, (i.e., 14: ) into the space. 15: / 16: public Writer( ) { 17: JSpace.Client client = new JSpace.Client( multicast_group, port ); 18: 19: Data data = new Data( ); 20: client.write( data ); 21: 22: 23: / 24: The actual program starts from the main( ) and instantiates a Writer 25: object. 26: args nothing to pass 28: / 29: 30: public static void main( String[] args ) { 31: new Writer( ); 32: 33:
3 This user client joins the Java Space with a JSpace.Client instantiation (line 17), creates a JSpace.Entry object that is named data (line 19) and that includes a double-typed variable (= ) (line 6), and sends it to distributed servers through client.write(data) (line 20). Note that all the client-side programs has been already coded, so that you don t have to write anything except your own test program. Each JSpace server should be multithreaded so as to interact with the master server, to watch requests from clients, and to hand each request in parallel: (1) The main thread: always reads a show or quit message from the master server and performs the according action. (2) The persistent child thread (named SpaceThread in the key answer): always waits for a new UDP multicast message from a client, instantiates a new per-request thread (SessionThread), and passes the message to the new thread. (3) A per-request child thread (named SessionThread in the key answer): receives a message from SpaceThread, extracts an entry from it if SessionThread should respond to this message, (otherwise simply discards it), and performs a write, read, or take operation, each corresponding to Hashtable.put(key, value), get(key), and remove(key). If the operation is read or take, SessionThread sends back the corresponding entry to the client, using an ordinary UDP socket (but not a multicast). The JSpace.Entry class has been already implemented and you can examine a given entry s data type, variable name, its value, and operation through gettype( ), getname( ), getvalue( ) and getoperation( ): public class Entry implements Serializable { // Attributes private String vartype; // a key to send this entry to a JSpace server private String varname; // a key to store this entry into a server hash private int operation; // JavaSpace Op: 0 = read, 1 = write, 2 = take private Object value; // a user-define value public String gettype( ) { return vartype; // returns the variable type of this entry. public String getname( ) { return varname; // returns the variable name of this entry. public int getoperation( ) { return operation; //returns the operation type: read=0, write=1, take=2 public Object getvalue( ) { return value; // returns an object that contains the value 3. JSpace.jar: Java Space Programs This is a jar file that includes all class files to launch a collection of distributed Java Space servers. It is located at ~css533/programming/prog2, and the corresponding java source code and byte code are found at the ~css533/programming/prog2/jspace/ directory. Java programs Descriptions Server.java Is a framework of a distributed Java Space server that establishes a JSCH connection from the master to all slave servers and launches a slave server at each remote computing node. The actual implementation is JSpace.java. Connection.java Establishes a JSCH connection to a remote computing node. JSpace.java Implements all the JSpace server features listed above. This is what you have to implement. Client.java Is instantiated within a Java Space client user program and interacts with distributed Java Space servers. Entry.java Is a data unit exchanged between a Java Space client and distributed servers. All java files except JSpace.java are worldwide readable and need not to be modified at all. Server.java and Connection.java are exactly the same as Lab 3. In other words, Server.java has already implemented
4 the code that establishes a secured TCP connection to each remote computing node and launches Java JSpace.Server there. All you need is to design and implement JSpace.java: In the following Server.java code, you will instantiate a JSpace object both at the master and slaves. (See the shaded and underlined statements below.) package JSpace; import com.jcraft.jsch.; import java.io.; import java.net.; import java.util.; public class Server { / The main() function runs both at the user local and remote args args[0] receives the configuration file name / public static void main( String[] args ) { if ( args.length == 1 ) new Server( args[0] ); // master server to run locally else if ( args.length == 0 ) new Server( ); // slave servers to run remotely else { // invalid arguments System.err.println( "usage: java -cp jsch jar:. JSpace.Server config.txt" ); System.exit( -1 ); / This is the constructor executed at a user-local configfile a configuration file name. It must include: user account (1st line); password (2nd line); and all remote host IP names (the rest). / public Server( String configfile ) { final int JschPort = 22; // Jsch IP port // Read configfile to initialize username, password, and hosts BufferedReader filereader = null; String username = null; String password = null; String multicast_group = null; int port = 0; ArrayList<String> hosts = new ArrayList<String>( ); try { // Open a configuration file filereader = new BufferedReader( new InputStreamReader ( new BufferedInputStream ( new FileInputStream ( new File( configfile ) ) ) ) ); // Read all the contents // 1st line: username username = filereader.readline( ); // Read the password from the console password = new String( System.console( ).readpassword( "Password: " ) ); // 2nd line: multicast group such as multicast_group = filereader.readline( ); // 3rd line: IP port such as port = Integer.parseInt( filereader.readline( ) ); // the rest: remote host IPs while ( filereader.ready( ) ) hosts.add( filereader.readline( ) ); filereader.close( ); catch( Exception e ) { e.printstacktrace( ); System.exit( -1 ); // A command to launch remotely:
5 // java -cp./jsch jar:. JSpace.Server String cur_dir = System.getProperty( "user.dir" ); String command = "java -cp " + cur_dir + "/jsch jar:" + cur_dir + " JSpace.Server"; // establish an ssh2 connection to each remote machine and run // JSpace.Server there. Connection connections[] = new Connection[hosts.size( )]; for ( int i = 0; i < hosts.size( ); i++ ) { connections[i] = new Connection( username, password, hosts.get( i ), command ); // the main body of the master server new JSpace( connections, multicast_group, port ); // close the ssh2 connection with each remote machine for ( int i = 0; i < hosts.size( ); i++ ) { connections[i].close( ); / This is the constructor executed at each remote machine. / public Server( ) { // receive an ssh2 connection from a user-local master server. Connection connection = new Connection( ); // the main body of the slave server new JSpace( connection ); 4. Client-side User Programs: Writer.java, Reader.java and Taker.java These programs are Java Space user applications, each writing a Java Space data unit (named an entry) into, reading it from, and taking it out of a Java Space that is globally maintained by a collection of Java Space servers, (i.e., JSpace.Server). They are located at ~css533/programming/prog2. Java programs Writer.java Reader.java Taker.java Descriptions Is an example user program that behaves as a Java Space client and writes a doubletype value, (i.e., ) to the Java Space identified with : To run your own Java Space environment, you need to change GroupAddress:Port. Is an example user program that behaves as a Java Space client and reads a doubletype variable from the Java Space identified with : To urn your own Java Space environment, you need to change GroupAddress:port. Is an example user program that behaves as a Java Space client and takes a doubletype variable out of the Java Space identified with : To run your own Java Space environment, you need to change GroupAddress:port. 5. Compilation Let us assume that you have created a new working directory prog2/. You need to make sure: (1) You must also create the JSpace/ directory under prog2/. (2) Client.java, Server.java, Conenction.java, Entry.java, and JSpace.java should be stored under prog2/jspace/. (3) Your JSpace.java must include package JSpace; at the top of their file. (4) Writer.java, Reader.java, and Taker.java are stored under prog2/. (5) ~css533/prog2/compile.sh, run.sh, and jsch jar should be copied under prog2/
6 Thereafter, to compile them all, run compile.sh at prog2/ #!/bin/sh javac -cp./jsch jar:. JSpace/.java jar cvf JSpace.jar JSpace/.class javac.java You will find JSpace.jar, Writer.class, Reader.class, and Taker.class, all under prog2/. 6. Execution First of all, you need to create config.txt under prog2/. The file format is: Line 1: your UnetID Line 2: group IP address Line 3: port Line 4: a remote host 1 s IP Line 5: a remote host 2 s IP For example, if you (with the mickey account) want to run the master server and three slave servers, you should write in config.txt as follows: mickey uw uw uw To launch servers, run run.sh at prog2/ #!/bin/sh java -cp jsch jar:jspace.jar JSpace.Server config.txt Thereafter, you can start a client user program such as Writer.class,Reader.class, and Taker.class. To run each, type from prog2/: java cp JSpace.jar:. Writer java cp JSapce.jar:. Reader java cp JSpace.jar:. Taker 7. Statement of Work Requirement 1: Implement the following two programs: (a) JSpace.java: the actual implementation of your Java Space server (b) TestProgram.java: a client-side user program that conducts much more serious tests onto your Java Space servers than just Writer.java, Reader.java and Taker.java do.
7 Requirement 2: Develop your distributed hashing algorithm, different from the original JSpace.java (i.e., the key answer that has each server take care of entries with the same data type). For instance, you can have each server take care of entries with the same initial of their variable names. Requirement 3: Verify the correctness of your Java Space server implementation, using Writer.java, Reader.java, Taker.java, and your TestProgram.java. Your report must include execution outputs to demonstrate your code verification, as changing the number of servers from 1 through to What to Turn in This programming assignment is due at the beginning of class on the due date. Please turn in a PDFformatted report through CollectIt, which includes the following items: Criteria Grade Documentation of your implementation of the JSpace server in one or two pages. Insufficient 5pts or too much (i.e., less than 1 page or more than 2 pages) documentation receives 4pts. Source code that adheres good modularization, coding style, and an appropriate amount of 5pts commends. Multithreading 0.5pts: The main thread interacts with the master server. 0.5pts: JpaceThread watches a multicast UDP message from a client. 0.5pts: SessionThread analyzes a given entry and performs its write, read, or take operation. JSpace operations 0.5pts: write chooses one JSpace server to store a new entry. 0.5pts: read/take suspends a SessionThread until a requested entry is written in a local hash. 0.5pts: take removes a requested entry from a local hash. Master/slave interaction 0.5pts: show lists all hash table contents on the administrator s window. 0.5pts: quit terminates all distributed servers quietly. 1pt: Good modularization, coding, style, and an appropriate amount of comments Execution output that verifies the correctness of all your implementation. 1pt: An execution scenario of 1 st : Writer.java, 2 nd Reader.java, and 3 rd Taker.java 1pt: An execution scenario of 1 st : Reader.java, 2 nd Writer.java, and 3 rd Taker.java 1pt: Output(s) of your TestProgram.java execution 0.5pts: Output(s) of the show command 0.5pts: Output(s) of the quit command 1pt: Verification output(s) when using one through to four JSpace servers Discussions about your own distributed hashing algorithm, limitations, and possible improvements of your program in one or two pages (firm). 2pts: Discussions about your own distributed hashing algorithm rather than the key answer s original hashing that stores entries with the same data type into the same server. 3pts: Discussions about limitations and possible improvements. Lab Sessions 3 counts 1pt. Please turn in this lab exercise through CollectIt by Program 2 s due date. Total Note that program 2 (including Lab 3) takes 15% of your final grade. 5pts 5pts 1pts 21pts
8 9. Hints Since HW2 focuses on distributed hashing, you do not have to spend too much time for UDP multicast as well as one-to-one communication. You can reuse the code from ~css533/samples/java_sockets/. Java programs Descriptions MulticastServer.java Usage: java MulticastServer groupip:port Use a snippet of this program inside your JSpace.JSpace.java to receive a multicast UDP packet. TcpUdpClient.java Usage: java Client udp tcp server port message. Use its udp( ) function inside your JSpace.JSpace.java to send a UDP packet to the corresponding JSpace.Client. Assuming that your JSpace server receive a multicast packet in packet, you can identify its client IP address by: InetAddress srcaddress = packet.getaddress( ) Your JSpace server needs to deserialize a byte array into an entry when receiving a DatagramPacket from a client as well as to serialize an entry into a byte array when sending it as a DatagramPacket to the client. Use the following two methods of JSpace.Entry class. / serialize() serializes a given entry into a byte array so that the array can be passed to a UDP entry an entry to be serialized into a byte a byte array that serialized a given entry. / public static byte[] serialize( Entry entry ) throws IOException / deserialize() reconstruct a new entry from a given byte buf a byte array to be deserialized back to a new a new entry that was deseralized from a gvien array, i.e. buf[]. / public static Entry deserialize( byte[] buf ) throws IOException, ClassNotFoundException Please note that all JSpace slave servers communicate with the master through System.in and System.out. Therefore, you cannot print out any debugging information through System.out in each slave. To see such information, your JSpace.JSpace.java should open a file and write such debugging information onto it. Be sure that the file name must be different for each slave server. Otherwise all slaves will end up with overwriting their messages onto the same file.
CSS 533 Program 3: Mobile-Agent Execution Platform Professor: Munehiro Fukuda Due date: see the syllabus
CSS 533 Program 3: Mobile-Agent Execution Platform Professor: Munehiro Fukuda Due date: see the syllabus 1. Purpose This assignment implements a mobile-agent execution platform that is in general facilitated
More informationCSS 543 Program 2: Multithreaded Schroedinger s Wave Simulation Professor: Munehiro Fukuda Due date: see the syllabus
CSS 543 Program 2: Multithreaded Schroedinger s Wave Simulation Professor: Munehiro Fukuda Due date: see the syllabus 1. Purpose This assignment uses multithreads to parallelize and thus to accelerate
More informationAssignment 1. Due date February 6, 2007 at 11pm. It must be submitted using submit command.
Assignment 1 Due date February 6, 2007 at 11pm. It must be submitted using submit command. Note: submit 4213 a1 . Read the manpages ("man submit") for more details on the submit command. It is
More informationIntroduction IS
Introduction IS 313 4.1.2003 Outline Goals of the course Course organization Java command line Object-oriented programming File I/O Business Application Development Business process analysis Systems analysis
More informationInput from Files. Buffered Reader
Input from Files Buffered Reader Input from files is always text. You can convert it to ints using Integer.parseInt() We use BufferedReaders to minimize the number of reads to the file. The Buffer reads
More informationCSS 534 Program 2: Parallelizing Wave Diffusion with MPI and OpenMP Professor: Munehiro Fukuda Due date: see the syllabus
CSS 534 Program 2: Parallelizing Wave Diffusion with MPI and OpenMP Professor: Munehiro Fukuda Due date: see the syllabus 1. Purpose In this programming assignment, we will parallelize a sequential version
More information1. Download the JDK 6, from
1. Install the JDK 1. Download the JDK 6, from http://java.sun.com/javase/downloads/widget/jdk6.jsp. 2. Once the file is completed downloaded, execute it and accept the license agreement. 3. Select the
More informationI/O in Java I/O streams vs. Reader/Writer. HW#3 due today Reading Assignment: Java tutorial on Basic I/O
I/O 10-7-2013 I/O in Java I/O streams vs. Reader/Writer HW#3 due today Reading Assignment: Java tutorial on Basic I/O public class Swimmer implements Cloneable { public Date geteventdate() { return (Date)
More informationBasic I/O - Stream. Java.io (stream based IO) Java.nio(Buffer and channel-based IO)
I/O and Scannar Sisoft Technologies Pvt Ltd SRC E7, Shipra Riviera Bazar, Gyan Khand-3, Indirapuram, Ghaziabad Website: www.sisoft.in Email:info@sisoft.in Phone: +91-9999-283-283 I/O operations Three steps:
More information09-1. CSE 143 Java GREAT IDEAS IN COMPUTER SCIENCE. Overview. Data Representation. Representation of Primitive Java Types. Input and Output.
CSE 143 Java Streams Reading: 19.1, Appendix A.2 GREAT IDEAS IN COMPUTER SCIENCE REPRESENTATION VS. RENDERING 4/28/2002 (c) University of Washington 09-1 4/28/2002 (c) University of Washington 09-2 Topics
More informationInput, Output and Exceptions. COMS W1007 Introduction to Computer Science. Christopher Conway 24 June 2003
Input, Output and Exceptions COMS W1007 Introduction to Computer Science Christopher Conway 24 June 2003 Input vs. Output We define input and output from the perspective of the programmer. Input is data
More informationInternet 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 informationDarshan Institute of Engineering & Technology for Diploma Studies
Streams A stream is a sequence of data. In Java a stream is composed of bytes. In java, 3 streams are created for us automatically. 1. System.out : standard output stream 2. System.in : standard input
More informationNetwork Programming. Powered by Pentalog. by Vlad Costel Ungureanu for Learn Stuff
Network Programming by Vlad Costel Ungureanu for Learn Stuff Java Network Protocols 2 Java Network Protocols 3 Addresses Innet4Address (32-bit) 85.122.23.145 - numeric pentalog.com symbolic Innet6Address
More informationCSS 503 Program 1: Parallelizing a Convex-Hull Program with Multi-Processes Professor: Munehiro Fukuda Due date: see the syllabus
CSS 503 Program 1: Parallelizing a Convex-Hull Program with Multi-Processes Professor: Munehiro Fukuda Due date: see the syllabus 1. Purpose In this programming assignment, we will parallelize a convex
More informationBasic Java Network Programming. CS211 July 30 th, 2001
Basic Java Network Programming CS211 July 30 th, 2001 The Network and OSI Model IP Header TCP Header TCP/IP: A Paradox TCP Connection Oriented and Connectionless Protocols Reliable: no loss, or duplication,
More informationDining philosophers (cont)
Administrivia Assignment #4 is out Due Thursday April 8, 10:00pm no late assignments will be accepted Sign up in labs this week for a demo time Office hour today will be cut short (11:30) Another faculty
More informationWeb 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 informationCSCI 136 Written Exam #1 Fundamentals of Computer Science II Spring 2014
CSCI 136 Written Exam #1 Fundamentals of Computer Science II Spring 2014 Name: This exam consists of 5 problems on the following 6 pages. You may use your double- sided hand- written 8 ½ x 11 note sheet
More information1.00 Lecture 30. Sending information to a Java program
1.00 Lecture 30 Input/Output Introduction to Streams Reading for next time: Big Java 15.5-15.7 Sending information to a Java program So far: use a GUI limited to specific interaction with user sometimes
More informationProgramming Languages and Techniques (CIS120)
Programming Languages and Techniques (CIS120) Lecture 30 April 4, 2018 I/O & Histogram Demo Chapters 28 HW7: Chat Server Announcements No penalty for late submission by tomorrow (which is a HARD deadline!)
More informationJava Input/Output. 11 April 2013 OSU CSE 1
Java Input/Output 11 April 2013 OSU CSE 1 Overview The Java I/O (Input/Output) package java.io contains a group of interfaces and classes similar to the OSU CSE components SimpleReader and SimpleWriter
More informationLab 1 : Java Sockets
Lab 1 : Java Sockets 1. Goals In this lab you will work with a low-level mechanism for distributed communication. You will discover that Java sockets do not provide: - location transparency - naming transparency
More informationJava Socket Workshop. July Purpose of this workshop:
Java Socket Workshop July 2012 Purpose of this workshop: The objective of this workshop is to gain experience with writing and compiling programs using the Java programming language. The exercises provide
More informationExceptions and Working with Files
Exceptions and Working with Files Creating your own Exceptions. You have a Party class that creates parties. It contains two fields, the name of the host and the number of guests. But you don t want to
More informationLab 5: Java IO 12:00 PM, Feb 21, 2018
CS18 Integrated Introduction to Computer Science Fisler, Nelson Contents Lab 5: Java IO 12:00 PM, Feb 21, 2018 1 The Java IO Library 1 2 Program Arguments 2 3 Readers, Writers, and Buffers 2 3.1 Buffering
More informationFile IO. Computer Science and Engineering College of Engineering The Ohio State University. Lecture 20
File IO Computer Science and Engineering College of Engineering The Ohio State University Lecture 20 I/O Package Overview Package java.io Core concept: streams Ordered sequences of data that have a source
More informationCS September 2017
Machine vs. transport endpoints IP is a network layer protocol: packets address only the machine IP header identifies source IP address, destination IP address Distributed Systems 01r. Sockets Programming
More informationIntroduction to Programming Using Java (98-388)
Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;
More informationByte and Character Streams. Reading and Writing Console input and output
Byte and Character Streams Reading and Writing Console input and output 1 I/O basics The io package supports Java s basic I/O (input/output) Java does provide strong, flexible support for I/O as it relates
More informationCN208 Introduction to Computer Programming
CN208 Introduction to Computer Programming Lecture #11 Streams (Continued) Pimarn Apipattanamontre Email: pimarn@pimarn.com 1 The Object Class The Object class is the direct or indirect superclass of every
More informationMultiplayer Game Programming 2/26
Multiplayer Game Programming 2/26 1. Turn off Windows Firewall 2. Download and install Python and Notepad++ a. Python.org downloads/python/install b. Notepad-plus-plus.org download/install 3. Download
More informationJava in 21 minutes. Hello world. hello world. exceptions. basic data types. constructors. classes & objects I/O. program structure.
Java in 21 minutes hello world basic data types classes & objects program structure constructors garbage collection I/O exceptions Strings Hello world import java.io.*; public class hello { public static
More informationCS1092: Tutorial Sheet: No 3 Exceptions and Files. Tutor s Guide
CS1092: Tutorial Sheet: No 3 Exceptions and Files Tutor s Guide Preliminary This tutorial sheet requires that you ve read Chapter 15 on Exceptions (CS1081 lectured material), and followed the recent CS1092
More informationSoftware Practice 1 - Socket
Software Practice 1 - Socket Terms of socket programming Socket Implementation (TCP, UDP) Socket with multithread Serialization Lab practice Prof. Joonwon Lee T.A. Jaehyun Song Jongseok Kim T.A. Sujin
More informationWeek 13 Lab - Exploring Connections & Remote Execution
Week 13 Lab - Exploring Connections & Remote Execution COSC244 & TELE202 1 Assessment This lab is worth 0.5%. The marks are awarded for completing the programming exercise and answering the questions.
More informationWeek 12. Streams and File I/O. Overview of Streams and File I/O Text File I/O
Week 12 Streams and File I/O Overview of Streams and File I/O Text File I/O 1 I/O Overview I/O = Input/Output In this context it is input to and output from programs Input can be from keyboard or a file
More informationExample: Copying the contents of a file
Administrivia Assignment #4 is due imminently Due Thursday April 8, 10:00pm no late assignments will be accepted Sign up in the front office for a demo time Dining Philosophers code is online www.cs.ubc.ca/~norm/211/2009w2/index.html
More informationNetwork. Dr. Jens Bennedsen, Aarhus University, School of Engineering Aarhus, Denmark
Network Dr. Jens Bennedsen, Aarhus University, School of Engineering Aarhus, Denmark jbb@ase.au.dk Outline Socket programming If we have the time: Remote method invocation (RMI) 2 Socket Programming Sockets
More informationJava Networking (sockets)
Java Networking (sockets) Rui Moreira Links: http://java.sun.com/docs/books/tutorial/networking/toc.html#sockets http://www.javaworld.com/javaworld/jw-12-1996/jw-12-sockets_p.html Networking Computers
More informationLab 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 informationOverview CSE 143. Data Representation GREAT IDEAS IN COMPUTER SCIENCE. Representation of Primitive Java Types. CSE143 Sp
Overview CSE 143 Topics Data representation bits and bytes Streams communicating with the outside world Basic Java files Other stream classes Streams Reading: Ch. 16 4/27/2004 (c) 2001-4, University of
More informationOverview CSE 143. Data Representation GREAT IDEAS IN COMPUTER SCIENCE. Representation of Primitive Java Types. CSE143 Au
Overview CSE 143 Topics Data representation bits and bytes Streams communicating with the outside world Basic Java files Other stream classes Streams Reading: Sec. 19.1, Appendix A2 11/2/2003 (c) 2001-3,
More informationOverview CSE 143. Data Representation GREAT IDEAS IN COMPUTER SCIENCE
Overview CSE 143 Topics Data representation bits and bytes Streams communicating with the outside world Basic Java files Other stream classes Streams Reading: Sec. 19.1, Appendix A2 11/2/2003 (c) 2001-3,
More informationJava 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 informationOptions for User Input
Options for User Input Options for getting information from the user Write event-driven code Con: requires a significant amount of new code to set-up Pro: the most versatile. Use System.in Con: less versatile
More informationOverview CSE 143. Input and Output. Streams. Other Possible Kinds of Stream Converters. Stream after Stream... CSE143 Wi
CSE 143 Overview Topics Streams communicating with the outside world Basic Java files Other stream classes Streams Reading: Ch. 16 2/3/2005 (c) 2001-5, University of Washington 12-1 2/3/2005 (c) 2001-5,
More informationInterprocess Communication
Interprocess Communication Nicola Dragoni Embedded Systems Engineering DTU Informatics 4.2 Characteristics, Sockets, Client-Server Communication: UDP vs TCP 4.4 Group (Multicast) Communication The Characteristics
More informationProgramming Languages and Techniques (CIS120)
Programming Languages and Techniques (CIS120) Lecture 31 November 17, 2017 I/O & Histogram Demo Chapters 28 Announcements HW8: SpellChecker Available on the website and Codio Due next Tuesday, November
More informationSoftware Practice 1 - File I/O
Software Practice 1 - File I/O Stream I/O Buffered I/O File I/O with exceptions CSV format Practice#6 Prof. Joonwon Lee T.A. Jaehyun Song Jongseok Kim (42) T.A. Sujin Oh Junseong Lee 1 (43) / 38 2 / 38
More informationProgramming Problems 15th Annual Computer Science Programming Contest
Programming Problems 15th Annual Computer Science Programming Contest Department of Mathematics and Computer Science Western Carolina University March 0, 200 Criteria for Determining Scores Each program
More informationCS 251 Intermediate Programming Java I/O Streams
CS 251 Intermediate Programming Java I/O Streams Brooke Chenoweth University of New Mexico Spring 2018 Basic Input/Output I/O Streams mostly in java.io package File I/O mostly in java.nio.file package
More informationText User Interfaces. Keyboard IO plus
Text User Interfaces Keyboard IO plus User Interface and Model Model: objects that solve problem at hand. User interface: interacts with user getting input from user giving output to user reporting on
More informationCS 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 informationTirgul 1. Course Guidelines. Packages. Special requests. Inner classes. Inner classes - Example & Syntax
Tirgul 1 Today s topics: Course s details and guidelines. Java reminders and additions: Packages Inner classes Command Line rguments Primitive and Reference Data Types Guidelines and overview of exercise
More informationJava for Interfaces and Networks
Java for Interfaces and Networks Threads and Networking Federico Pecora School of Science and Technology Örebro University federico.pecora@oru.se Federico Pecora Java for Interfaces and Networks Lecture
More informationObject-Oriented Programming Design. Topic : Streams and Files
Electrical and Computer Engineering Object-Oriented Topic : Streams and Files Maj Joel Young Joel Young@afit.edu. 18-Sep-03 Maj Joel Young Java Input/Output Java implements input/output in terms of streams
More informationShell Interface Assignment
Page 1 of 9 Shell Interface Assignment Creating a Shell Interface Using Java This assignment consists of modifying a Java program so that it serves as a shell interface that accepts user commands and then
More informationCS506 Web Design & Development Final Term Solved MCQs with Reference
with Reference I am student in MCS (Virtual University of Pakistan). All the MCQs are solved by me. I followed the Moaaz pattern in Writing and Layout this document. Because many students are familiar
More informationLab 2: File Input and Output
Lab 2: File Input and Output This lab introduces how to handle files as both input and output. We re coming back to Tracery (which you implemented in Lab 1) with this assignment but instead of always reading
More informationJava How to Program, 9/e. Copyright by Pearson Education, Inc. All Rights Reserved.
Java How to Program, 9/e Copyright 1992-2012 by Pearson Education, Inc. All Rights Reserved. Data stored in variables and arrays is temporary It s lost when a local variable goes out of scope or when
More informationPerforming input and output operations using a Byte Stream
Performing input and output operations using a Byte Stream public interface DataInput The DataInput interface provides for reading bytes from a binary stream and reconstructing from them data in any of
More informationLecture 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 informationToday. Book-keeping. File I/O. Subscribe to sipb-iap-java-students. Inner classes. Debugging tools
Today Book-keeping File I/O Subscribe to sipb-iap-java-students Inner classes http://sipb.mit.edu/iap/java/ Debugging tools Problem set 1 questions? Problem set 2 released tomorrow 1 2 So far... Reading
More informationCSCD 330 Network Programming
CSCD 330 Network Programming Lecture 8 Client-Server Programming Threads Winter 2015 Reading: Chapter 2, Relevant Links Some Material in these slides from J.F Kurose and K.W. Ross All material copyright
More informationLecture 4: Exceptions. I/O
Lecture 4: Exceptions. I/O Outline Access control. Class scope Exceptions I/O public class Malicious { public static void main(string[] args) { maliciousmethod(new CreditCard()); } static void maliciousmethod(creditcard
More informationCSCD 330 Network Programming
CSCD 330 Network Programming Lecture 8 Client-Server Programming Threads Spring 2018 Reading: Chapter 2, Relevant Links - Threads Some Material in these slides from J.F Kurose and K.W. Ross All material
More informationOverview CSE 143. Data Representation GREAT IDEAS IN COMPUTER SCIENCE
CSE 143 Overview Topics Data representation bits and bytes Streams communicating with the outside world Basic Java files Other stream classes Streams Reading: Ch. 16 10/20/2004 (c) 2001-4, University of
More informationJava Programming. Manuel Oriol, March 22nd, 2007
Java Programming Manuel Oriol, March 22nd, 2007 Goal Teach Java to proficient programmers 2 Roadmap Java Basics Eclipse Java GUI Threads and synchronization Class loading and reflection Java Virtual Machines
More informationExceptions and Libraries
Exceptions and Libraries RS 9.3, 6.4 Some slides created by Marty Stepp http://www.cs.washington.edu/143/ Edited by Sarah Heckman 1 Exceptions exception: An object representing an error or unusual condition.
More informationTiming ListOperations
Timing ListOperations Michael Brockway November 13, 2017 These slides are to give you a quick start with timing operations in Java and with making sensible use of the command-line. Java on a command-line
More informationVirtualians.ning.pk. 2 - Java program code is compiled into form called 1. Machine code 2. native Code 3. Byte Code (From Lectuer # 2) 4.
1 - What if the main method is declared as private? 1. The program does not compile 2. The program compiles but does not run 3. The program compiles and runs properly ( From Lectuer # 2) 4. The program
More informationChapter 10. IO Streams
Chapter 10 IO Streams Java I/O The Basics Java I/O is based around the concept of a stream Ordered sequence of information (bytes) coming from a source, or going to a sink Simplest stream reads/writes
More informationLesson 3: Accepting User Input and Using Different Methods for Output
Lesson 3: Accepting User Input and Using Different Methods for Output Introduction So far, you have had an overview of the basics in Java. This document will discuss how to put some power in your program
More informationCSCD 330 Network Programming
CSCD 330 Network Programming Lecture 8 Client-Server Programming Threads Spring 2017 Reading: Chapter 2, Relevant Links - Threads Some Material in these slides from J.F Kurose and K.W. Ross All material
More informationתוכנה 1 תרגול 8 קלט/פלט רובי בוים ומתי שמרת
תוכנה 1 תרגול 8 קלט/פלט רובי בוים ומתי שמרת A Typical Program Most applications need to process some input and produce some output based on that input The Java IO package (java.io) is to make that possible
More informationNetworking Basics. network communication.
JAVA NETWORKING API Networking Basics When you write Java programs that communicate over the network, you are programming at the application layer. Typically, you don't need to concern yourself with the
More informationObject Oriented Design. Object-Oriented Design. Inheritance & Polymorphism. Class Hierarchy. Goals Robustness Adaptability Flexible code reuse
Object-Oriented Design Object Oriented Design Goals Robustness Adaptability Flexible code reuse Principles Abstraction Encapsulation Modularity March 2005 Object Oriented Design 1 March 2005 Object Oriented
More informationCS 231 Data Structures and Algorithms, Fall 2016
CS 231 Data Structures and Algorithms, Fall 2016 Dr. Bruce A. Maxwell Department of Computer Science Colby College Course Description Focuses on the common structures used to store data and the standard
More informationStreams and File I/O
Chapter 9 Streams and File I/O Overview of Streams and File I/O Text File I/O Binary File I/O File Objects and File Names Chapter 9 Java: an Introduction to Computer Science & Programming - Walter Savitch
More informationNetwork Programming Benoît Garbinato
Network Programming Benoît Garbinato 1 Network programming Network programming is not distributed programming (somewhat lower-level) They both rely on: computers as processing & storage resources a network
More informationProject #1 Computer Science 2334 Fall 2008
Project #1 Computer Science 2334 Fall 2008 User Request: Create a Word Verification System. Milestones: 1. Use program arguments to specify a file name. 10 points 2. Use simple File I/O to read a file.
More informationI/O Streams. Object-oriented programming
I/O Streams Object-oriented programming Outline Concepts of Data Streams Streams and Files File class Text file Binary file (primitive data, object) Readings: GT, Ch. 12 I/O Streams 2 Data streams Ultimately,
More informationCOMP 213. Advanced Object-oriented Programming. Lecture 19. Input/Output
COMP 213 Advanced Object-oriented Programming Lecture 19 Input/Output Input and Output A program that read no input and produced no output would be a very uninteresting and useless thing. Forms of input/output
More informationPieter 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 informationWhat is Serialization?
Serialization 1 Topics What is Serialization? What is preserved when an object is serialized? Transient keyword Process of serialization Process of deserialization Version control Changing the default
More informationGetting Started in Java. Bill Pugh Dept. of Computer Science Univ. of Maryland, College Park
Getting Started in Java Bill Pugh Dept. of Computer Science Univ. of Maryland, College Park Hello, World In HelloWorld.java public class HelloWorld { public static void main(string [] args) { System.out.println(
More informationHST 952. Computing for Biomedical Scientists Lecture 8
Harvard-MIT Division of Health Sciences and Technology HST.952: Computing for Biomedical Scientists HST 952 Computing for Biomedical Scientists Lecture 8 Outline Vectors Streams, Input, and Output in Java
More informationProject #1 rev 2 Computer Science 2334 Fall 2013 This project is individual work. Each student must complete this assignment independently.
Project #1 rev 2 Computer Science 2334 Fall 2013 This project is individual work. Each student must complete this assignment independently. User Request: Create a simple magazine data system. Milestones:
More informationObject-Oriented Design. March 2005 Object Oriented Design 1
Object-Oriented Design March 2005 Object Oriented Design 1 Object Oriented Design Goals Robustness Adaptability Flexible code reuse Principles Abstraction Encapsulation Modularity March 2005 Object Oriented
More informationJava Coding style guide 1. Java. Coding Style Guide. (July 2015)
Java Coding style guide 1 Java Coding Style Guide (July 2015) This coding style guide provides advices how to design and document your software so that your source code is easier to read, to debug, to
More informationPrinciples, Models and Applications for Distributed Systems M
Università degli Studi di Bologna Facoltà di Ingegneria Principles, Models and Applications for Distributed Systems M Lab assignment 2 (worked-out) Connectionless Java Sockets Luca Foschini 2010/2011 Exercise
More informationCIS 120 Final Exam May 3, Name (printed): Pennkey (login id):
CIS 120 Final Exam May 3, 2013 Name (printed): Pennkey (login id): My signature below certifies that I have complied with the University of Pennsylvania s Code of Academic Integrity in completing this
More informationProject 1 Computer Science 2334 Spring 2016 This project is individual work. Each student must complete this assignment independently.
Project 1 Computer Science 2334 Spring 2016 This project is individual work. Each student must complete this assignment independently. User Request: Create a simple movie data system. Milestones: 1. Use
More informationPIC 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 informationJava for Interfaces and Networks (DT3029)
Java for Interfaces and Networks (DT3029) Lecture 3 Threads and Networking Federico Pecora federico.pecora@oru.se Center for Applied Autonomous Sensor Systems (AASS) Örebro University, Sweden Capiscum
More informationCS 101 Fall 2005 Midterm 2 Name: ID:
This exam is open text book but closed-notes, closed-calculator, closed-neighbor, etc. Questions are worth different amounts (in particular, the final two questions are worth substantially more than any
More informationExceptions vs. Errors Exceptions vs. RuntimeExceptions try...catch...finally throw and throws
Lecture 14 Summary Exceptions vs. Errors Exceptions vs. RuntimeExceptions try...catch...finally throw and throws 1 By the end of this lecture, you will be able to differentiate between errors, exceptions,
More informationJava Programming Language Advance Feature
Java Programming Language Advance Feature Peter.Cheng founder_chen@yahoo.com.cn http://www.huihoo.com 2004-04 Huihoo - Enterprise Open Source http://www.huihoo.com 1 Course Goal The main goal of this course
More informationEach command-line argument is placed in the args array that is passed to the static main method as below :
1. Command-Line Arguments Any Java technology application can use command-line arguments. These string arguments are placed on the command line to launch the Java interpreter after the class name: public
More information