Advance Computer Programming Networking Basics – explores the java.net package which provides support for networking. – Also Called “programming for the.

Slides:



Advertisements
Similar presentations
1 Ports and IPv6. 2 Ports Transmission Control Protocol (TCP) or the User Datagram Protocol (UDP), used for communication Generally speaking, a computer.
Advertisements

Network Layer and Transport Layer.
Socket Programming.
1 Java Networking – Part I CS , Spring 2008/9.
Networking Theory (part 2). Internet Architecture The Internet is a worldwide collection of smaller networks that share a common suite of communication.
Java Socket Support Presentation by: Lijun Yuan Course Number: cs616.
CS3771 Today: network programming with sockets  Previous class: network structures, protocols  Next: network programming Sockets (low-level API) TODAY!
COMP1681 / SE15 Introduction to Programming
Networking Support In Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Networks 1 CS502 Spring 2006 Network Input & Output CS-502 Operating Systems Spring 2006.
CS-3013 & CS-502, Summer 2006 Network Input & Output1 CS-3013 & CS-502, Summer 2006.
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.
Networking java.net package, which provides support for networking. Its creators have called Java “programming for the Internet.” Socket :- A network socket.
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.
Computer Networks  Network - A system of computers interconnected in order to share information.  Data transmission - consists of sending and receiving.
TCP/IP protocols Communication over Internet is mostly TCP/IP (Transmission Control Protocol over Internet Protocol) TCP/IP "stack" is software which allows.
Chapter 17 Networking Dave Bremer Otago Polytechnic, N.Z. ©2008, Prentice Hall Operating Systems: Internals and Design Principles, 6/E William Stallings.
Networking Basics TCP/IP TRANSPORT and APPLICATION LAYER Version 3.0 Cisco Regional Networking Academy.
70-291: MCSE Guide to Managing a Microsoft Windows Server 2003 Network Chapter 3: TCP/IP Architecture.
NetworkProtocols. Objectives Identify characteristics of TCP/IP, IPX/SPX, NetBIOS, and AppleTalk Understand position of network protocols in OSI Model.
1 ELEN602 Lecture 2 Review of Last Lecture Layering.
Jaringan Komputer Dasar OSI Transport Layer Aurelio Rahmadian.
 Socket  The combination of an IP address and a port number. (RFC 793 original TCP specification)  The name of the Berkeley-derived application programming.
TCP/IP Networking Review Covered Subjects:  Packet Switched Network Structure  Issues of PSNs  Ports & IP Numbers  Delivery Services  Domain Name.
Jozef Goetz, Application Layer PART VI Jozef Goetz, Position of application layer The application layer enables the user, whether human.
1 Version 3.0 Module 11 TCP Application and Transport.
1 CSC111H Client-Server: An Introduction Dennis Burford
I. Basic Network Concepts. I.1 Networks Network Node Address Packet Protocol.
Vassil Roussev 2 A socket is the basic remote communication abstraction provided by the OS to processes. controlled by operating system.
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.
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.
4061 Session 25 (4/17). Today Briefly: Select and Poll Layered Protocols and the Internets Intro to Network Programming.
ECEN “Internet Protocols and Modeling”, Spring 2012 Course Materials: Papers, Reference Texts: Bertsekas/Gallager, Stuber, Stallings, etc Class.
Socket Programming Introduction. Socket Definition A network socket is one endpoint in a two-way communication flow between two programs running over.
Advanced UNIX programming Fall 2002, lecture 16 Instructor: Ashok Srinivasan Acknowledgements: The syllabus and power point presentations are modified.
By Vivek Dimri. Basic Concepts on Networking IP Address – Protocol – Ports – The Client/Server Paradigm – Sockets The Java Networking Package – The InetAddress.
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.
Advanced Java Session 4 New York University School of Continuing and Professional Studies.
MT311 Java Application Development and Programming Languages Li Tak Sing ( 李德成 )
McGraw-Hill Chapter 23 Process-to-Process Delivery: UDP, TCP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
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.
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.
Introduction Chapter 1. TCP/IP Reference Model Why Another Model? Although the OSI reference model is universally recognized, the historical and technical.
Networking Mehdi Einali Advanced Programming in Java 1.
Network Programming. These days almost all devices.
Liang, Introduction to Java Programming, Ninth Edition, (c) 2013 Pearson Education, Inc. All rights reserved. 1 Chapter 33 Networking.
SOCKET PROGRAMMING Presented By : Divya Sharma.
Transport Protocols Relates to Lab 5. An overview of the transport protocols of the TCP/IP protocol suite. Also, a short discussion of UDP.
MCA – 405 Elective –I (A) Java Programming & Technology
Chapter 1 Introduction Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011.
Lecture 6: TCP/IP Networking By: Adal Alashban
Network Programming Introduction
Topic 5: Communication and the Internet
I. Basic Network Concepts
Process-to-Process Delivery:
Transport Protocols An overview of the transport protocols of the TCP/IP protocol suite. Also, a short discussion of UDP.
Networking.
Lecture 6: TCP/IP Networking 1nd semester By: Adal ALashban.
Networking Theory (part 2)
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.
Networking Theory (part 2)
Presentation transcript:

Advance Computer Programming Networking Basics – explores the java.net package which provides support for networking. – Also Called “programming for the Internet” – Java.net Package is basically a collection of Networking classes – These networking classes encapsulate the “socket” paradigm.

Advance Computer Programming – The networking support first found in 4.2 BSD eventually became the de facto standard for the Internet – TCP/IP remains the primary standard for communications within the Internet

Advance Computer Programming Socket Overview – A network socket is a lot like an electrical socket – Think how your electric bill is created e.g. – Sockets are simply the end-points of a connection between two devices – In fact, the Socket has no idea what’s coming it just sees a stream of bytes – When the server gets the bytes, it’s up to your server code to figure out what those bytes are supposed to mean

Advance Computer Programming – The same idea applies to network sockets, except we talk about TCP/IP packets and IP addresses rather than electrons and street addresses – Internet Protocol (IP) is a low-level routing protocol that breaks data into small packets and sends them to an address across a network but no guarantee to deliver said packets – Transmission Control Protocol (TCP) is a higher- level protocol that manages to robustly string together these packets

– sorting and retransmitting them as necessary to reliably transmit your data – A third protocol, User Datagram Protocol (UDP), sits next to TCP and can be used directly to support fast, connectionless, unreliable transport of packets.

Advance Computer Programming Client / Server – It seems complicated when you read about it in corporate marketing statements but it is actually quite simple. – A server is anything that has some resource that can be shared – There are compute servers, which provide computing power; print servers, which manage a collection of printers; disk servers, which provide networked disk space; web servers, which store web pages.

Advance Computer Programming – A client is simply any other entity that wants to gain access to a particular server. – The interaction between client and server is just like the interaction between a lamp and an electrical socket. – The power grid of the house is the server, and the lamp is a power client. – The server is a permanently available resource, while the client is free to “unplug” after it is has been served

Advance Computer Programming – In Berkeley sockets, the notion of a socket allows a single computer to serve many different clients at once, as well as serving many different types of information – This feat is managed by the introduction of a port, which is a numbered socket on a particular machine. – A server process is said to “listen” to a port until a client connects to it. – A server is allowed to accept multiple clients connected to the same port number, although each session is unique.

Advance Computer Programming Reserved Sockets – TCP/IP reserves the lower 1,024 ports for specific protocols – if you have spent any time surfing the Internet. Port number 21 is for FTP 23 is for Telnet 25 is for 79 is for finger 80 is for HTTP 119 is for netnews

Advance Computer Programming – Here’s an example of a client requesting a single file, /index.html, and the server replying that it has successfully found the file and is sending it to the client:

Advance Computer Programming Proxy Servers – A proxy server speaks the client side of a protocol to another server – This is often required when clients have certain restrictions on which servers they can connect to. – A proxy server has the additional ability to filter certain requests or cache the results of those requests for future use. – When a popular web site is being hit by hundreds of users, a proxy server can get the contents of the web server’s popular pages once, saving expensive internetwork transfers while providing faster access to those pages to the clients.

Advance Computer Programming Internet Addressing – Every computer on the Internet has an address. – An Internet address is a number that uniquely identifies each computer on the Net. – all Internet addresses consisted of 32-bit values. – This address type was specified by IPv4 (Internet Protocol, version 4) – However, a new addressing scheme, called IPv6 (Internet Protocol, version 6) has come into play – IPv6 uses a 128-bit value to represent an address. Although there are several reasons for and advantages to IPv6,

Advance Computer Programming Domain Naming Service (DNS) – The Internet wouldn’t be a very friendly place to navigate if everyone had to refer to their addresses as numbers. – For example, it is difficult to imagine seeing “ at the bottom of an advertisement.

Advance Computer Programming The Networking Classes and Interfaces

Advance Computer Programming – several new classes were added by Java 2 – Some of these are to support the new IPv6 addressing scheme – three new classes, Inet4Address, Inet6Address, and URI, are briefly we will be discussing at the end. – java.net package’s interfaces are listed here

Advance Computer Programming InetAddress – making a phone call, sending mail, or establishing a connection across the Internet, addresses are fundamental – The InetAddress class is used to encapsulate – both the numerical IP address and the domain name for that address – Java 2, version 1.4, InetAddress can handle both IPv4 and IPv6 addresses. – We will be studying IPv4 addressing scheme.

Advance Computer Programming Factory Methods – The InetAddress class has no visible constructors. – To create an InetAddress object, you have to use one of the available factory methods – Factory methods are convention, whereby static methods in a class return an instance of that class. – Three commonly used InetAddress factory methods are

Advance Computer Programming // Demonstrate InetAddress. import java.net.*; class InetAddressTest { public static void main(String args[]) throws UnknownHostException { InetAddress Address = InetAddress.getLocalHost(); System.out.println(Address); Address = InetAddress.getByName("osborne.com"); System.out.println(Address); InetAddress SW[] = InetAddress.getAllByName(" for (int i=0; i<SW.length; i++) System.out.println(SW[i]); } Output: – default/ – osborne.com/ – –

Advance Computer Programming Instance Methods

Advance Computer Programming

TCP/IP Client Sockets – TCP/IP sockets are used to implement reliable, bidirectional, persistent, point-to- point, stream-based connections between hosts on the Internet – A socket can be used to connect Java’s I/O system to other programs that may reside either on the local machine or on any other machine on the Internet. – There are two kinds of TCP sockets in Java One is for servers other is for clients

Advance Computer Programming – The ServerSocket class is designed to be a “listener,” – The Socket class is designed to connect to server sockets and initiate protocol exchanges. – There are no methods or constructors that explicitly expose the details of establishing that connection