Java Socket Programming and Java RMI CS 15-440 Recitation 1, Sep 8, 2011 Majd F. Sakr, Vinay Kolar, Mohammad Hammoud.

Slides:



Advertisements
Similar presentations
What is RMI? Remote Method Invocation –A true distributed computing application interface for Java, written to provide easy access to objects existing.
Advertisements

RMI Varun SainiYing Chen. What is RMI? RMI is the action of invoking a method of a remote interface on a remote object. It is used to develop applications.
Socket Programming By Ratnakar Kamath. What Is a Socket? Server has a socket bound to a specific port number. Client makes a connection request. Server.
Remote Method Invocation
Remote Object Invocation Tran, Van Hoai Department of Systems & Networking Faculty of Computer Science & Engineering HCMC University of Technology.
Company LOGO Remote Method Invocation Georgi Cholakov, Emil Doychev, University of Plovdiv “Paisii.
Network Programming Chapter 11 Lecture 6. Networks.
Remote Method Invocation Chin-Chih Chang. Java Remote Object Invocation In Java, the object is serialized before being passed as a parameter to an RMI.
DISTRIBUTED FILE SYSTEM USING RMI
Advanced Java Class Network Programming. Network Protocols Overview Levels of Abstraction –HTTP protocol: spoken by Web Servers and Web Clients –TCP/IP:
1 HANDOUT 14 Remote Method Invocation (RMI) BY GEORGE KOUTSOGIANNAKIS THIS DOCUMENT CAN NOT BE REPRODUCED OR DISTRIBUTED WITHOUT TH E WRITTEN PERMISSION.
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.
Sockets  Defined as an “endpoint for communication.”  Concatenation of IP address + port.  Used for server-client communication.  Server waits for.
CS3771 Today: network programming with sockets  Previous class: network structures, protocols  Next: network programming Sockets (low-level API) TODAY!
Introduction to Remote Method Invocation (RMI)
1 School of Computing Science Simon Fraser University CMPT 771/471: Internet Architecture and Protocols Socket Programming Instructor: Dr. Mohamed Hefeeda.
Socket Communication Sockets provide an abstraction of two-point communication The two sides only read/write without concern for how data is translated.
An Introduction to Internetworking. Algorithm for client-server communication with UDP (connectionless) A SERVER A CLIENT Create a server-socket (listener)and.
Network Programming and Java Sockets 1 Dr. Christian Vecchiola Postdoctoral Research Fellow Cloud Computing and Distributed Systems.
1 Inter-Process Communication: Network Programming using TCP Java Sockets Rajkumar Buyya Grid Computing and Distributed Systems (GRIDS) Laboratory Dept.
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. Client/Server Communication At a basic level, network-based systems consist of a server, client, and a media for communication as.
Network Programming CSE 132. iClicker/WUTexter Question How many of the following statements are true? In the model-view-controller paradigm, a swing.
+ A Short Java RMI Tutorial Usman Saleem
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved Chapter 4 Communication.
Establishing communication with Envirobat using TCP/IP Presented by Apourva Parthasarathy Date : 18/06/13.
 TCP (Transport Control Protocol) is a connection-oriented protocol that provides a reliable flow of data between two computers.  TCP/IP Stack Application.
RGEC MEERUT(IWT CS703) 1 Java Networking RGEC Meerut.
Spring/2002 Distributed Software Engineering C:\unocourses\4350\slides\DefiningThreads 1 RMI.
Silberschatz, Galvin, and Gagne  1999 Applied Operating System Concepts Chapter 15: Distributed Communication Sockets Remote Procedure Calls (RPCs) Remote.
1 Network Programming and Java Sockets. 2 Network Request Result a client, a server, and network Client Server Client machine Server machine Elements.
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.  Establish contact (connection).  Exchange information (bi-directional).  Terminate contact.
Introduction to Sockets “A socket is one endpoint of a two-way communication link between two programs running on the network. A socket is bound to a port.
 2003 Joel C. Adams. All Rights Reserved. Calvin CollegeDept of Computer Science(1/11) Java Sockets and Simple Networking Joel Adams and Jeremy Frens.
Networking Terminology: ISP (Internet service provider) – dialup, dsl, cable LAN (local area network) IP (internet protocol) address, eg
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Chapter 43 Remote Method Invocation.
CS 158A1 1.4 Implementing Network Software Phenomenal success of the Internet: – Computer # connected doubled every year since 1981, now approaching 200.
Java Programming: Advanced Topics 1 Networking Programming Chapter 11.
Java Network Programming Network Programming Spring 2000 Jeffrey E. Care
TCP/IP Protocol Stack IP Device Drivers TCPUDP Application Sockets (Gate to network) TCP: –Establish connection –Maintain connection during the communication.
UNIT-6. Basics of Networking TCP/IP Sockets Simple Client Server program Multiple clients Sending file from Server to Client Parallel search server.
Remote Method Invocation A Client Server Approach.
Distributed Systems CS Project 1: File Storage and Access Kit (FileStack) Recitation 1, Aug 29, 2013 Dania Abed Rabbou and Mohammad Hammoud.
1 Lecture 15 Remote Method Invocation Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung Institute of Technology.
Network Programming with Java java.net.InetAddress: public static void main(String[] args) throws UnknownHostException { InetAddress localAddress = InetAddress.getLocalHost();
Netprog Java RMI1 Remote Method Invocation.
SOCKET PROGRAMMING WITH JAVA By Collin Donaldson.
Java’s networking capabilities are declared by the classes and interfaces of package java.net, through which Java offers stream-based communications that.
Network Programming. These days almost all devices.
CC P ROCESAMIENTO M ASIVO DE D ATOS O TOÑO 2016 Lab 2: Mensaje Aidan Hogan
Remote Method Invocation Internet Computing Workshop Lecture 17.
Internet Socket Programing
Client-Server Communication
Java Distributed Computing
MCA – 405 Elective –I (A) Java Programming & Technology
Remote Method Invocation
What is RMI? Remote Method Invocation
Beyond HTTP Up to this point we have been dealing with software tools that run on browsers and communicate to a server that generates files that can be.
Socket Programming Cal Poly Pomona Young CS380.
Java Socket Programming and Java RMI CS
Outline Introduction Networking Basics Understanding Ports and Sockets
Chapter 40 Remote Method Invocation
Remote Method Invocation
Chapter 46 Remote Method Invocation
Chapter 46 Remote Method Invocation
Java Socket Programming and Java RMI CSE 291
Presentation transcript:

Java Socket Programming and Java RMI CS Recitation 1, Sep 8, 2011 Majd F. Sakr, Vinay Kolar, Mohammad Hammoud

Today… Announcements All programs run on Unix cluster Use any editor/file-transfer you want Project 1 Java Socket Programming Java RMI

Project 1 Learning objective: Apply the knowledge of Process and Communication and Naming to design a Distributed File System. Duration: 3 weeks Solo project

Project Objectives Design a Distributed File System called File Stack using RMIs Functions provided: Create/Read/Write files and directories Meta-operations: list files, size

Components Storage Servers: Stores Files Naming Server: Maps a file to storage server Clients: Contact Naming to get storage server Carry out file operation on storage server

Design Storage Server Registration Storage Servers register to Naming on boot Client functions Contact naming to get a file-handle to access a file Perform file operation All functionalities through RMI Stubs/Skeletons Serialization

Design/Implementation hints Remote Method Invocation (RMI) heavy We have an excellent start-up code Read “Design guidelines” and “Implementation hints” Come back to us Earlier the better

Java Socket Programming Sockets: An API for using underlying networks An abstraction like “File” Request-response

Java Socket Programming IP Address To name a machine/host Port Port maps to one connection-end-point For your apps: Use ports through Types of Sockets UDP (Datagram) vs TCP (Conn-oriented)

java.net class A package that provide base classes and API for Socket programming Open/close socket Accept Read/Write Send/Receive

TCP Sockets Classes java.net.ServerSocket, java.net.Socket DataInputStream, DataOutputStream

TCP Socket Server Client 1.Socket client = new Socket(server, port_id); 2.DIS/DOS  Same as in server 3.Read/Write  Same as in server 4.Close  Same as in server 1.ServerSocket server = new ServerSocket( PORT ); 2.Socket client = server.accept(); 3.DataInputStream is = new DataInputStream(client.getInputStream()); 4.DataOutputStream os = new DataOutputStream(client.getOutputStream()); 5.String line = is.readLine(); 6.os.writeBytes(“Hello\n”); 7.client.close();

Exercise Write a simple chat server and client using TCP Sockets (Estimated time: 20 mins) Step 1: Client connects to server. Sends a message Server sends back all the message that it has received from all clients Step 2: One client should not block the server

Java RMI What is RMI? What do we need Where is the server? Which object/method should I call? What if I do not know the server object definition? How to communicate?

Java RMI How do we implement? Look-up for server/object RMI Registry Remote interface Extend Remote interface Throw RemoteException Make it accessible How does the magic happen? Stub/Skeleton, Serialize

References