MCA – 405 Elective –I (A) Java Programming & Technology

Slides:



Advertisements
Similar presentations
TCP/IP MODEL Maninder Kaur
Advertisements

Network Programming Chapter 11 Lecture 6. Networks.
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.
1. Introducing Java Computing  What is Java Computing?  Why Java Computing?  Enterprise Java Computing  Java and Internet Web Server.
Networking Theory (part 2). Internet Architecture The Internet is a worldwide collection of smaller networks that share a common suite of communication.
CS3771 Today: network programming with sockets  Previous class: network structures, protocols  Next: network programming Sockets (low-level API) TODAY!
System Programming Practical session 10 Java sockets.
McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Application Layer PART VI.
What Is TCP/IP? The large collection of networking protocols and services called TCP/IP denotes far more than the combination of the two key protocols.
I NTRODUCTION OF S OCKET P ROGRAMMING L.Aseel AlTurki King Saud University.
Gursharan Singh Tatla Transport Layer 16-May
Process-to-Process Delivery:
Socket Programming -What is it ? -Why bother ?. Basic Interface for programming networks at transport level It is communication end point Used for inter.
Chapter 17 Networking Dave Bremer Otago Polytechnic, N.Z. ©2008, Prentice Hall Operating Systems: Internals and Design Principles, 6/E William Stallings.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 12 Communicating over.
TCP/IP: Basics1 User Datagram Protocol (UDP) Another protocol at transport layer is UDP. It is Connectionless protocol i.e. no need to establish & terminate.
 Socket  The combination of an IP address and a port number. (RFC 793 original TCP specification)  The name of the Berkeley-derived application programming.
Jozef Goetz, Application Layer PART VI Jozef Goetz, Position of application layer The application layer enables the user, whether human.
Internet Applications and Network Programming Dr. Abraham Professor UTPA.
 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.
Dr. John P. Abraham Professor University of Texas Pan American Internet Applications and Network Programming.
1. I NTRODUCTION TO N ETWORKS Network programming is surprisingly easy in Java ◦ Most of the classes relevant to network programming are in the java.net.
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.
Position of application layer. Application layer duties.
Socket Programming Introduction. Socket Definition A network socket is one endpoint in a two-way communication flow between two programs running over.
CSI 3125, Preliminaries, page 1 Networking. CSI 3125, Preliminaries, page 2 Networking A network represents interconnection of computers that is capable.
UNIT-6. Basics of Networking TCP/IP Sockets Simple Client Server program Multiple clients Sending file from Server to Client Parallel search server.
Agenda Socket Programming The OSI reference Model The OSI protocol stack Sockets Ports Java classes for sockets Input stream and.
The OSI Model. Understanding the OSI Model In early 1980s, manufacturers began to standardize networking so that networks from different manufacturers.
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.
1 Network Communications A Brief Introduction. 2 Network Communications.
Advance Computer Programming Networking Basics – explores the java.net package which provides support for networking. – Also Called “programming for the.
Lecture 4 : Network Architectures (cont..) 1. 2 Summary of OSI Layers.
1 K. Salah Application Layer Module K. Salah Network layer duties.
Network Programming. These days almost all devices.
IST 201 Chapter 11 Lecture 2. Ports Used by TCP & UDP Keep track of different types of transmissions crossing the network simultaneously. Combination.
Distributed Systems1 Socket API  The socket API is an Interprocess Communication (IPC) programming interface originally provided as part of the Berkeley.
SOCKET PROGRAMMING Presented By : Divya Sharma.
Application Layer Functionality and Protocols Abdul Hadi Alaidi
Object-Orientated Analysis, Design and Programming
Introduction to Networks
Networking Based Applications
Client-Server Communication
Transport Protocols Relates to Lab 5. An overview of the transport protocols of the TCP/IP protocol suite. Also, a short discussion of UDP.
Client-Server Model and Sockets
Lecture 6: TCP/IP Networking By: Adal Alashban
Introduction to Networks
NET323 D: Network Protocols
Client-Server Interaction
CCNA 2 v3.1 Module 10 Intermediate TCP/IP
Transport Protocols Relates to Lab 5. An overview of the transport protocols of the TCP/IP protocol suite. Also, a short discussion of UDP.
I. Basic Network Concepts
Transport Protocols Relates to Lab 5. An overview of the transport protocols of the TCP/IP protocol suite. Also, a short discussion of UDP.
TCP/IP Networking An Example
NET323 D: Network Protocols
Process-to-Process Delivery:
Transport Protocols An overview of the transport protocols of the TCP/IP protocol suite. Also, a short discussion of UDP.
Lecture 2: Overview of TCP/IP protocol
Networking Theory (part 2)
CPEG514 Advanced Computer Networkst
PART 5 Transport Layer.
Process-to-Process Delivery: UDP, TCP
Transport Protocols Relates to Lab 5. An overview of the transport protocols of the TCP/IP protocol suite. Also, a short discussion of UDP.
Exceptions and networking
Network programming Lecture 1 Prepared by: Dr. Osama Mokhtar.
Networking Theory (part 2)
Presentation transcript:

MCA – 405 Elective –I (A) Java Programming & Technology By: Abhishek Khare (SVIM - INDORE M.P) MCA – 405 Elective –I (A) Java Programming & Technology © 2013 Abhishek Khare JAVA Notes (SVIM) All Rights Reserved.

UNIT-5 Networking & RMI The term network programming refers to writing programs that execute across multiple devices (computers), in which the devices are all connected to each other using a network. The java.net package of the J2SE APIs contains a collection of classes and interfaces that provide the low-level communication details The java.net package provides support for the two common network protocols: TCP: TCP stands for Transmission Control Protocol, which allows for reliable communication between two applications. TCP is typically used over the Internet Protocol, which is referred to as TCP/IP. UDP: UDP stands for User Datagram Protocol, a connection-less protocol that allows for packets of data to be transmitted between applications. © 2013 Abhishek Khare JAVA Notes (SVIM) All Rights Reserved.

Introduction: What Is a Socket? Normally, a server runs on a specific computer and has a socket that is bound to a specific port number. The server just waits, listening to the socket for a client to make a connection request. On the client-side: The client knows the hostname of the machine on which the server is running and the port number on which the server is listening.  © 2013 Abhishek Khare JAVA Notes (SVIM) All Rights Reserved.

A socket is one endpoint (combination of an IP address and a port number) of a two-way communication link between two programs running on the network. A socket is bound to a port number so that the TCP layer can identify the application that data is destined to be sent. © 2013 Abhishek Khare JAVA Notes (SVIM) All Rights Reserved.

What is client server ? “relating to a computer system in which a central server supports a number of networked workstations.” © 2013 Abhishek Khare JAVA Notes (SVIM) All Rights Reserved.

RESERVED SOCKET Reserved port numbers.                                     Service        Port no.                        echo           7                                            daytime     13                        ftp              21                        telnet         23                        smtp          25                        finger         79                        http           80                        pop3         110  If we consider the range of the port numbers, there are 0 to 65,535 ports available. The port numbers ranging from 0 - 1023 are reserved ports or we can say that are restricted ports. All the 0 to 1023 ports are reserved for use by well-known services such as FTP, telnet and http and other system services. These ports are called well-known ports.  © 2013 Abhishek Khare JAVA Notes (SVIM) All Rights Reserved.

Proxy servers In computer networks, a proxy server is a server (a computer system or an application) that acts as an intermediary for requests from clients seeking resources from other servers. A client connects to the proxy server, requesting some service, such as a file, connection, web page, or other resource available from a different server and the proxy server evaluates the request as a way to simplify and control its complexity. © 2013 Abhishek Khare JAVA Notes (SVIM) All Rights Reserved.

What is an InetAddress? It is a class in Java which represents an Internet Protocol (IP) address. An instance of an InetAddress consists of an IP address and possibly corresponding hostname.  The Class represents an Internet address as Two fields: 1- Host name(The String)=Contain the name of the Host. 2- Address(an int)= The 32 bit IP address. © 2013 Abhishek Khare JAVA Notes (SVIM) All Rights Reserved.

TCP sockets, UDP sockets Datagram communication: The datagram communication protocol, known as UDP (user datagram protocol), is a connectionless protocol, meaning that each time you send datagrams, you also need to send the local socket descriptor and the receiving socket's address. As you can tell, additional data must be sent each time a communication is made. Stream communication: The stream communication protocol is known as TCP (transfer control protocol). Unlike UDP, TCP is a connection-oriented protocol. In order to do communication over the TCP protocol, a connection must first be established between the pair of sockets. While one of the sockets listens for a connection request (server), the other asks for a connection (client). Once two sockets have been connected, they can be used to transmit data in both (or either one of the) directions. © 2013 Abhishek Khare JAVA Notes (SVIM) All Rights Reserved.

Java RMI Overview Java RMI or Remote Method Invocation is an example of Remote Procedure Call (RPC)enabling client program to locate the server object and remotely invoke the methods from server through server’s stub and skeleton function © 2013 Abhishek Khare JAVA Notes (SVIM) All Rights Reserved.

The main Java RMI component consists of 3 elements: Client Server Invoke method on remote object Server Process that owns remote object Registry Name server that relates objects with unique names From the figure above, we can see the process of Java RMI is divided into 4 steps: Instantiate server object and then register it to RMI registry service with unique name Client program locates server object from RMI registry service with associated name Once server object is found is RMI registry, RMI registry returns server stub Server stub handles the data communication with Server skeleton on server side.  © 2013 Abhishek Khare JAVA Notes (SVIM) All Rights Reserved.

Server Object Interface Server Object Server Stub An interface defines the methods for the server object Server Object An instance of the server object interface Server Stub An object that resides on the client host and serves as a representative of the remote server object Server Skeleton An object that resides on the server host. It communicates with the stub and the actual server object RMI Registry It is service to register remote objects and to provide naming services for locating objects Client program A program that invokes the methods in the remote server object © 2013 Abhishek Khare JAVA Notes (SVIM) All Rights Reserved.

Example Chat communication is the process of exchanging messages between two systems continuously. Anyone can break the communication. Both systems come with the following same responsibilities. Reading from keyboard. Uses an input stream like BufferedReader connected to System.in. Sending data to the other system what is read from keyboard. Uses an output stream like PrintWriter connected to getOutputStream() method of Socket. Receiving data from the other system. Uses an input stream like BufferedReader connected to getInputStream() method of Socket. As the responsibilities are same, both client and server programs contain the same stream objects and same code. The order of using stream objects varies in the while loop. © 2013 Abhishek Khare JAVA Notes (SVIM) All Rights Reserved.

To come out of the chat, type Ctrl+C. Client program: GossipClient.java To come out of the chat, type Ctrl+C. Client sends first and then receives where as server first receives and then sends. © 2013 Abhishek Khare JAVA Notes (SVIM) All Rights Reserved.

© 2013 Abhishek Khare JAVA Notes (SVIM) All Rights Reserved.

© 2013 Abhishek Khare JAVA Notes (SVIM) All Rights Reserved.