Distributed Systems CS 15-440 Project 1: File Storage and Access Kit (FileStack) Recitation 1, Aug 29, 2013 Dania Abed Rabbou and Mohammad Hammoud.

Slides:



Advertisements
Similar presentations
CS Network Programming CS 3331 Fall CS 3331 Outline Socket programming Remote method invocation (RMI)
Advertisements

Basic Socket Programming with Java. What is a socket?  Generally refers to a stream connecting processes running in different address spaces (across.
Socket Programming.
A CHAT CLIENT-SERVER MODULE IN JAVA BY MAHTAB M HUSSAIN MAYANK MOHAN ISE 582 FALL 2003 PROJECT.
1 Java Networking – Part I CS , Spring 2008/9.
WECPP1 Java networking Jim Briggs based on notes by Amanda Peart based on Bell & Parr's bonus chapter
1 L52 Networking (1). 2 OBJECTIVES In this chapter you will learn:  To understand Java networking with URLs, sockets and datagrams.  To implement Java.
Java Socket Support Presentation by: Lijun Yuan Course Number: cs616.
CIS – Spring Instructors: Geoffrey Fox, Bryan Carpenter Computational Science and.
Client/Server In Java An Introduction to TCP/IP and Sockets.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved L22 (Chapter 25) Networking.
© Lethbridge/Laganière 2001 Chap. 3: Basing Development on Reusable Technology 1 Let’s get started. Let’s start by selecting an architecture from among.
An Introduction to Internetworking. Algorithm for client-server communication with UDP (connectionless) A SERVER A CLIENT Create a server-socket (listener)and.
13-Jul-15 Sockets and URLs. 2 Sockets A socket is a low-level software device for connecting two computers together Sockets can also be used to connect.
Networking with Java CSc 335 Object-Oriented Programming and Design Spring 2009.
CEG3185 Tutorial 4 Prepared by Zhenxia Zhang Revised by Jiying Zhao (2015w)
Socket Programming -What is it ? -Why bother ?. Basic Interface for programming networks at transport level It is communication end point Used for inter.
Distributed Systems CS Project 1: File Storage and Access Kit (FileStack) Recitation 1, Aug 29, 2013 Dania Abed Rabbou and Mohammad Hammoud.
Socket programming 1. getByName import java.net.*; public class GetHostName { public static void main (String args[]) { String host = "
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 12 Communicating over.
CS 390- Unix Programming Environment CS 390 Unix Programming Environment Topics to be covered: Distributed Computing Fundamentals.
1 CSCD 330 Network Programming Winter 2015 Some Material in these slides from J.F Kurose and K.W. Ross All material copyright Lecture 6 Application.
REVIEW On Friday we explored Client-Server Applications with Sockets. Servers must create a ServerSocket object on a specific Port #. They then can wait.
Internet Applications and Network Programming Dr. Abraham Professor UTPA.
RGEC MEERUT(IWT CS703) 1 Java Networking RGEC Meerut.
Practicum: - Client-Server Computing in Java Fundamental Data Structures and Algorithms Margaret Reid-Miller 13 April 2004.
Object Oriented Programming in Java Lecture 16. Networking in Java Concepts Technicalities in java.
Li Tak Sing COMPS311F. Case study: consumers and producers A fixed size buffer which can hold at most certain integers. A number of producers which generate.
1 Chapter 28 Networking. 2 Objectives F To comprehend socket-based communication in Java (§28.2). F To understand client/server computing (§28.2). F To.
Remote Shell CS230 Project #4 Assigned : Due date :
Java Socket programming. Socket programming with TCP.
L 2 - 1 3( 1/ 20) : Java Network Programming. The Socket API The previous contents describe client-server interaction that application programs use when.
Socket Programming Using JAVA Asma Shakil Semester 1, 2008/2009.
Introduction to Socket Programming in Android Jules White Bradley Dept. of Electrical and Computer Engineering Virginia Tech
Networks Sockets and Streams. TCP/IP in action server ports …65535 lower port numbers ( ) are reserved port echo7 time13 ftp20 telnet23.
CS390- Unix Programming Environment CS 390 Unix Programming Environment Java Socket Programming.
The Client-Server Model And the Socket API. Client-Server (1) The datagram service does not require cooperation between the peer applications but such.
CSI 3125, Preliminaries, page 1 Networking. CSI 3125, Preliminaries, page 2 Networking A network represents interconnection of computers that is capable.
CSI 3125, Preliminaries, page 1 Networking. CSI 3125, Preliminaries, page 2 Inetaddress Class When establishing a connection across the Internet, addresses.
TCP/IP Protocol Stack IP Device Drivers TCPUDP Application Sockets (Gate to network) TCP: –Establish connection –Maintain connection during the communication.
Prepared by Dr. Jiying Zhao University of Ottawa Canada.
UNIT-6. Basics of Networking TCP/IP Sockets Simple Client Server program Multiple clients Sending file from Server to Client Parallel search server.
Java Programming II Java Network (I) Java Programming II.
Distributed Systems CS Project 2: FileStack Synchronization and Replication Recitation 6, Oct. 2, 2014 Dania Abed Rabbou and Mohammad Hammoud.
MT311 Java Application Development and Programming Languages Li Tak Sing ( 李德成 )
1 CSCD 330 Network Programming Winter 2016 Some Material in these slides from J.F Kurose and K.W. Ross All material copyright Lecture 6 Application.
Spring/2002 Distributed Software Engineering C:\unocourses\4350\slides\DefiningThreads 1 Java API for distributed computing.
Agenda Socket Programming The OSI reference Model The OSI protocol stack Sockets Ports Java classes for sockets Input stream and.
Threads CS 21b. Threads in Java zDefinition Õunit of program control that represents an execution sequence zJava supports multi-threaded execution * Programs.
1 K. Salah Application Layer Module K. Salah Network layer duties.
Network Programming. These days almost all devices.
Prepared by: Dr. Abdallah Mohamed, AOU-KW Unit9: Internet programming 1.
Java 13. Networking public class SumTest {
Object-Orientated Analysis, Design and Programming
Client-Server Communication
Lecture 21 Sockets 1 (Not in D&D) Date.
Distributed Computing
RMI Packages Overview java.rmi java.rmi.server java.rmi.registry
Network Programming Introduction
MCA – 405 Elective –I (A) Java Programming & Technology
NETWORK PROGRAMMING CNET 441
Socket Programming Cal Poly Pomona Young CS380.
An Introduction to TCP/IP and Sockets
PRESENTED To: Sir Abid………. PRESENTED BY: Insharah khan………. SUBJECT:
UNIT-6.
Networking.
Chapter 40 Remote Method Invocation
Chapter 46 Remote Method Invocation
Chapter 46 Remote Method Invocation
Presentation transcript:

Distributed Systems CS Project 1: File Storage and Access Kit (FileStack) Recitation 1, Aug 29, 2013 Dania Abed Rabbou and Mohammad Hammoud

Logistics Solo project Programming Language: Java Design Document Due Date: Sept. 9, 2013 Project Due Date: Sept. 25, 2013 Q&A: Piazza, Office Hours, & Appointments

Learning Objective Apply the knowledge of client-server communication and Remote Method Invocation (RMI) to build a Distributed File System (DFS)

Distributed File System (DFS)  Why File Systems?  To organize data (as files)  To provide a means for applications to store, access, and modify data  Why Distributed File Systems (DFSs)?  Sharing and managing data in distributed systems  Big data continues to grow  A DFS can hold sheer volumes of data (contrary to a local file system) and provide access to these data to many clients dispersed across networks

Entities & Architecture Storage Servers (SSs) Each SS stores physically files to share in a directory (denoted as temporary directory) in its local file system Naming Server (NS) Stores metadata about all shared files in the form of a mapping from filenames to storage servers (like DNS) Clients Perform operations on files (e.g., write, read etc.) Architecture Based on client-server architecture

Client Operations Operations on files/directories: CreateFile, CreateDirectory, Read, Write, Size, List, Delete, IsDirectory Auxiliary operation: getStorage Ideally, SSs must handle all file operations In our case, NS handles some, to maintain integrity and reduce communication overhead

Communication (1) Registration (2) Duplicate Files, Create, Delete (3) CreateFile, CreateDirectory, IsDirectory, Delete, List, GetStorage (4) Results, Storage Server (5) Read, Write, Size (6) Results Request-Reply Communication Paradigm

Communication via Sockets Sockets provide a communication mechanism between networked computers A Socket is an end-point of communication that is identified by an IP address and port number A client sends requests to a server using a client socket A server receives clients’ requests via a listening socket

Communication via Sockets (cont’d.) Listening Socket Service Socket Client Socket

Socket Communication Recipe 1.Server instantiates a ServerSocket object (usually passing a port number). This socket is referred to as the listening socket. 1.Server invokes the accept() method that awaits incoming client connections. 1.Client instantiates Socket object (passing server name and port number). This socket is referred to as a client socket*. 1. Accept() returns a new socket referred to as a service socket on which the client reads/writes. * The constructor of the Socket class attempts to connect the client to the specified server and port number. If communication is established, the client now has a Socket object capable of communicating with the server.

ServerSocket Methods SNMethods with Description 1public ServerSocket(int port) throws IOException Attempts to create a server socket bound to the specified port. An exception occurs if the port is already bound by another application. 2public ServerSocket() throws IOException Creates an unbound server socket. When using this constructor, use the bind() method when you are ready to bind the server socket. 3public Socket accept() throws IOException Waits for an incoming client. This method blocks until either a client connects to the server on the specified port or the socket times out, assuming that the time-out value has been set using the setSoTimeout() method. Otherwise, this method blocks indefinitely. 4public void bind(SocketAddress host) Binds the socket to the specified server and port in the SocketAddress object. Use this method if you instantiated the ServerSocket using the no-argument constructor. 5public SocketAddress getLocalSocketAddress() Returns the address of the endpoint this socket is bound to, or null if it not bound yet.

Socket Methods SNMethods with Description 1public Socket(String host, int port) throws UnknownHostException, IOException This method attempts to connect to the specified server at the specified port. If this constructor does not throw an exception, the connection is successful and the client is connected to the server. 2public Socket() Creates an unconnected socket. Use the connect() method to connect this socket to a server. 3public void connect(SocketAddress host, int timeout) throws IOException This method connects the socket to the specified host. This method is needed only when you instantiated the Socket using the no-argument constructor. 4public InputStream getInputStream() throws IOException Returns the input stream of the socket. The input stream is connected to the output stream of the remote socket. 5public OutputStream getOutputStream() throws IOException Returns the output stream of the socket. The output stream is connected to the input stream of the remote socket 6public SocketAddress getLocalSocketAddress() throws IOException Returns the address of the endpoint this socket is bound to, or null if it is not bound yet. 7public void close() throws IOException Closes the socket, which makes this Socket object no longer capable of connecting again to any server

InetSocketAddress Methods SNMethods with Description 1 public InetSocketAdddress(InetAddress address, int port) Creates a socket address from an IP address and a port number. 2public InetSocketAddress(String hostname, int port) Creates a socket address from a hostname and a port number. 3public InputStream getInputStream() throws IOException Returns the input stream of the socket. The input stream is connected to the output stream of the remote socket. 4public OutputStream getOutputStream() throws IOException Returns the output stream of the socket. The output stream is connected to the input stream of the remote socket 5public void close() throws IOException Closes the socket, which makes this Socket object no longer capable of connecting again to any server *A valid port value is between 0 and 65535

Multi-threading A class intended to execute as a thread must implement the Runnable interface public class Service implements Runnable STEP 1: Implement the method run() public void run() { //thread’s logic goes here } STEP 2: Instantiate a Thread object Thread t = new Thread(new Service()) STEP 5: Invoke start() on the new thread t.start() // invokes the run() method