SlideShare ist ein Scribd-Unternehmen logo
1 von 27
Networking
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Introduction Computers running on the Internet communicate with each other  using TCP or UDP protocols 1. TCP/IP   IP  stands for Internet protocol, it’s a datagram protocol, which  means transmitted packets of information are not guaranteed to  be delivered. IP is a connectionless protocol. Since IP packets are never guaranteed to arrive at their  destination, a higher level protocol  TCP  is used to provide a  service that guarantees delivery
Application that require a reliable point to point channel to  communicate use TCP to communicate. Examples  Hypertext Transfer Protocol (HTTP), File Transfer  Protocol(FTP) , and Telnet. User Datagram Protocol(UDP) UDP is protocol that send independent packets of data  called datagram from one computer to another with no guarantee about the arrival. UDP is not connection based like TCP, rather it sends independent packets of data called datagrams from one application to another.
Sockets  Sockets  are software interfaces that connect an application to a  network.  On the Internet each machine has 65536 addressable ports it  can use. Server programs listen to these ports for any incoming  service request. A client program needs to open a port of its own before it can  connect to a server port at the other end. The port numbers range from 0 to 1023 are restricted. They are  reserved for use by well known services such as HTTP and FTP
[object Object],[object Object],[object Object],[object Object],[object Object]
Internet Addressing * Every computer on the Internet has an  address.  * An Internet address is a number that uniquely identifies each  computer on the Net. * Originally, all Internet addresses consisted of 32-bit values,  also known as IPv4 (Internet Protocol, version 4). * IPv6 uses a 128-bit value to represent an address, so it  supports a much larger address space writing,  * IPv6 is not supported by all environments.
There are 32 bits in an IPv4 IP address, and we often refer to them  as a sequence of four numbers between 0 and 255 separated by dots (.). Domain Naming Service (DNS) * Refer to the addresses as numbers, is difficult,  like  http://192.9.9.1/ .  * So it is mapped to name  www.osborne.com   that makes  it easy to remember.
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
static InetAddress[ ] getAllByName(String hostName) throws UnknownHostException This method returns an array of InetAddresses that represent all of the addresses that a particular name resolves to. Example InetAddressTest.java
TCP Sockets  There are two kinds of TCP sockets in Java. One is for servers,  and the other is for clients. The  ServerSocket  class is designed to be a “listener,”  which waits for clients to connect before doing anything. The  Socket  class is designed to connect to server sockets  and initiate protocol exchanges. The creation of a  Socket  object implicitly establishes a connection  between the client and server .
Example  Whois.java * Opens a connection to a port on the InterNIC server * Sends the command-line argument down the socket, and then  prints the data that is returned * InterNIC will try to look up the argument as a registered Internet domain name, then send back the IP address and contact  information for that site.
URL The  URL  provides a reasonably intelligible form to uniquely identify or address information on the Internet. Every browser uses them to identify information on the Web. Examples  of URLs are  http://www.osborne.com/   and  http://www.osborne.com:80/index.htm A URL specification is based on four components. The first is the protocol to use, separated from the rest of the  locator by a colon (:). Common protocols are http, ftp,
The second component is the host name or IP address of the  host to use. The third component, the port number, is an optional parameter, The fourth part is the actual file path. Java’s  URL  class has got methods that gives information about  the URL. Example  URLDemo.java
Communication with Remote Systems using TCP TCP is used to implement reliable, bidirectional, persistent  connections between hosts on the Internet. The java.net package provide two classes that allow you to create two kind of sockets. The classes are Socket and ServerSocket. Socket class The Socket class is used to create the client sockets, is  designed to connect to server socket and initiate the protocol  exchange. When we create the Socket object it implicitly establishes the  connection between the client and the server.
It is not possible to get the details of establishing that connection  because the Socket class does not provide any method for this  purpose. Socket (String hostName, int port) This constructor is used to create a client socket and  connect the local host to the specified hostName and port. Socket (InetAddress ipAddress, int port)   This constructor is used to create a client socket using a  Pre-existing InetAddress object and a port. There should be two ports for all TCP connections:  a port on the remote machine  a port on local machine through which the client communicates.
ServerSocket class basically used to create the server sockets, is designed to  be a listener, which wait for client to connect before doing anything. The ServerSocket class is used to create servers that listen for either Local or remote client to connect to them on standard ports. Constructors in ServerSocket class ServerSocket (int port) throws IOException This constructor is used to create the server socket on the  specified port with default queue length of 50 Queue length  Each server socket object is associated with  queue length attribute which tell the system how many client  Connection it can leave pending before it can simply refuse connection
ServerSocket (int port, int queueLength) throws IOException This constructor is used to create a server socket on the  Specified port with a specified queue length.
Writing Client/Server using TCP To write the server program use the following steps 1.Create a server socket and begin listening. 2.Call the accept method to get new connection. 3.Create the input and output stream for the returned socket. 4.Conduct the conversation based on agreed protocol. 5.Close the client streams and socket. 6.Go back to step 2 or continue the step 7. 7.Close the server socket
To write the client use the following steps 1.Create the client socket connection. 2.Acquire the read and write streams for the socket. 3.Use the streams according to the server’s protocol. 4.Close the streams. 5.Close the socket.
Communicating with remote systems using UDP UDP cannot guarantee whether the sent or received datagrams reach at their destinations. UDP is mainly useful to broadcast low value information on a  frequent basis, so that losing a communication does not effect the  service. The java.net package provides two classes namely DatagramPacket  And DatagramSocket to communicate with remote systems.
DatagramPacket class is used to implement a connectionless packet delivery service. This class define two constructors DatagramPacket(byte[]buf, int length) This constructor is used for receiving data over a  DatagramSocket. DatagramPacket(byte[]buf, int length, InetAddress address,  int port) This constructor is used for transmitting datagrams,this  requires destination machine address and the port number apart  from the buffer and the size parameters.
DatagramSocket class The DatagramSocket class provides the functionality for  sending and receiving the datagrams. This class defines three constructors DatagramSocket() Construct a datagram socket and bind it to any available  port on the local host machine. DatagramSocket(int port) Construct a datagram socket and bind it to the  specified port on the local host machine. DatagramSocket(int port, InetAddress Iaddr) Construct a datagram socket and bind it to the specified local address.
Writing Client/Server System using UDP To  write a server using UDP  follow the following steps 1.Create the datagram socket on a specific port. 2.Invoke the receive() method to wait for incoming packets. 3.According to the agreed protocol respond to received packets. 4.Repeat step 2 or continue to step 5. 5.Close the datagram socket. Example  UDPServer.java
To  write a Client using UDP  follow the following basic steps 1.Create the datagram socket on any available port. 2.Create the address to send data. 3.Send the data according to the Server’s protocol. 4.Wait for incoming data 5.Go back to step 3 or step 4 or go to step 6 6.Close the datagram socket. Example  UDPClient.java

Weitere Àhnliche Inhalte

Was ist angesagt?

Socket programming-in-python
Socket programming-in-pythonSocket programming-in-python
Socket programming-in-pythonYuvaraja Ravi
 
Java Network Programming
Java Network ProgrammingJava Network Programming
Java Network Programmingbackdoor
 
Java networking programs - theory
Java networking programs - theoryJava networking programs - theory
Java networking programs - theoryMukesh Tekwani
 
Sockets
SocketsSockets
Socketssivindia
 
A Short Java Socket Tutorial
A Short Java Socket TutorialA Short Java Socket Tutorial
A Short Java Socket TutorialGuo Albert
 
Simple chat room using python
Simple chat room using pythonSimple chat room using python
Simple chat room using pythonVISHAL VERMA
 
Network Programming in Java
Network Programming in JavaNetwork Programming in Java
Network Programming in JavaTushar B Kute
 
Socket programming or network programming
Socket programming or network programmingSocket programming or network programming
Socket programming or network programmingMmanan91
 
Java Networking
Java NetworkingJava Networking
Java NetworkingAnkit Desai
 
Introduction to TCP/IP
Introduction to TCP/IPIntroduction to TCP/IP
Introduction to TCP/IPFrank Fang Kuo Yu
 
Basic socket programming
Basic socket programmingBasic socket programming
Basic socket programmingKristian Arjianto
 
Socket programming using java
Socket programming using javaSocket programming using java
Socket programming using javaUC San Diego
 
Network programming in Java
Network programming in JavaNetwork programming in Java
Network programming in JavaTushar B Kute
 
Python Sockets
Python SocketsPython Sockets
Python Socketspythontic
 
Socket Programming Tutorial
Socket Programming TutorialSocket Programming Tutorial
Socket Programming TutorialJignesh Patel
 

Was ist angesagt? (20)

Socket programming-in-python
Socket programming-in-pythonSocket programming-in-python
Socket programming-in-python
 
Java Network Programming
Java Network ProgrammingJava Network Programming
Java Network Programming
 
java networking
 java networking java networking
java networking
 
Networking in java
Networking in javaNetworking in java
Networking in java
 
Java networking programs - theory
Java networking programs - theoryJava networking programs - theory
Java networking programs - theory
 
Sockets
SocketsSockets
Sockets
 
A Short Java Socket Tutorial
A Short Java Socket TutorialA Short Java Socket Tutorial
A Short Java Socket Tutorial
 
Simple chat room using python
Simple chat room using pythonSimple chat room using python
Simple chat room using python
 
Network Programming in Java
Network Programming in JavaNetwork Programming in Java
Network Programming in Java
 
Socket programming or network programming
Socket programming or network programmingSocket programming or network programming
Socket programming or network programming
 
Java Networking
Java NetworkingJava Networking
Java Networking
 
Introduction to TCP/IP
Introduction to TCP/IPIntroduction to TCP/IP
Introduction to TCP/IP
 
Basic socket programming
Basic socket programmingBasic socket programming
Basic socket programming
 
Socket programming using java
Socket programming using javaSocket programming using java
Socket programming using java
 
Network programming in Java
Network programming in JavaNetwork programming in Java
Network programming in Java
 
Networking in python by Rj
Networking in python by RjNetworking in python by Rj
Networking in python by Rj
 
Python Sockets
Python SocketsPython Sockets
Python Sockets
 
28 networking
28  networking28  networking
28 networking
 
Socket Programming Tutorial
Socket Programming TutorialSocket Programming Tutorial
Socket Programming Tutorial
 
Lecture25
Lecture25Lecture25
Lecture25
 

Andere mochten auch

Unit III IPV6 UDP
Unit III IPV6 UDPUnit III IPV6 UDP
Unit III IPV6 UDPsangusajjan
 
User Datagram protocol For Msc CS
User Datagram protocol For Msc CSUser Datagram protocol For Msc CS
User Datagram protocol For Msc CSThanveen
 
Introduction of tcp, ip & udp
Introduction of tcp, ip & udpIntroduction of tcp, ip & udp
Introduction of tcp, ip & udprahul kundu
 
Tcp Udp Icmp And The Transport Layer
Tcp Udp Icmp And The Transport LayerTcp Udp Icmp And The Transport Layer
Tcp Udp Icmp And The Transport Layertmavroidis
 
TCP & UDP protocols
TCP & UDP protocols TCP & UDP protocols
TCP & UDP protocols masifnaeem
 
message passing
 message passing message passing
message passingAshish Kumar
 
TCP- Transmission Control Protocol
TCP-  Transmission Control Protocol TCP-  Transmission Control Protocol
TCP- Transmission Control Protocol Akhil .B
 
User datagram protocol (udp)
User datagram protocol (udp)User datagram protocol (udp)
User datagram protocol (udp)Ramola Dhande
 
Transmission Control Protocol (TCP)
Transmission Control Protocol (TCP)Transmission Control Protocol (TCP)
Transmission Control Protocol (TCP)k33a
 
UDP - User Datagram Protocol
UDP - User Datagram ProtocolUDP - User Datagram Protocol
UDP - User Datagram ProtocolPeter R. Egli
 
23 Process to_Process_Delivery_UDP_TCP_and_SCTP
23 Process to_Process_Delivery_UDP_TCP_and_SCTP23 Process to_Process_Delivery_UDP_TCP_and_SCTP
23 Process to_Process_Delivery_UDP_TCP_and_SCTPAhmar Hashmi
 

Andere mochten auch (13)

Unit III IPV6 UDP
Unit III IPV6 UDPUnit III IPV6 UDP
Unit III IPV6 UDP
 
User Datagram protocol For Msc CS
User Datagram protocol For Msc CSUser Datagram protocol For Msc CS
User Datagram protocol For Msc CS
 
Introduction of tcp, ip & udp
Introduction of tcp, ip & udpIntroduction of tcp, ip & udp
Introduction of tcp, ip & udp
 
Tcp
TcpTcp
Tcp
 
Chapter 3 : User Datagram Protocol (UDP)
Chapter 3 : User Datagram Protocol (UDP)Chapter 3 : User Datagram Protocol (UDP)
Chapter 3 : User Datagram Protocol (UDP)
 
Tcp Udp Icmp And The Transport Layer
Tcp Udp Icmp And The Transport LayerTcp Udp Icmp And The Transport Layer
Tcp Udp Icmp And The Transport Layer
 
TCP & UDP protocols
TCP & UDP protocols TCP & UDP protocols
TCP & UDP protocols
 
message passing
 message passing message passing
message passing
 
TCP- Transmission Control Protocol
TCP-  Transmission Control Protocol TCP-  Transmission Control Protocol
TCP- Transmission Control Protocol
 
User datagram protocol (udp)
User datagram protocol (udp)User datagram protocol (udp)
User datagram protocol (udp)
 
Transmission Control Protocol (TCP)
Transmission Control Protocol (TCP)Transmission Control Protocol (TCP)
Transmission Control Protocol (TCP)
 
UDP - User Datagram Protocol
UDP - User Datagram ProtocolUDP - User Datagram Protocol
UDP - User Datagram Protocol
 
23 Process to_Process_Delivery_UDP_TCP_and_SCTP
23 Process to_Process_Delivery_UDP_TCP_and_SCTP23 Process to_Process_Delivery_UDP_TCP_and_SCTP
23 Process to_Process_Delivery_UDP_TCP_and_SCTP
 

Ähnlich wie Md13 networking

Unit 8 Java
Unit 8 JavaUnit 8 Java
Unit 8 Javaarnold 7490
 
5_6278455688045789623.pptx
5_6278455688045789623.pptx5_6278455688045789623.pptx
5_6278455688045789623.pptxEliasPetros
 
Network programming in java - PPT
Network programming in java - PPTNetwork programming in java - PPT
Network programming in java - PPTkamal kotecha
 
Module 1 networking basics-2
Module 1   networking basics-2Module 1   networking basics-2
Module 1 networking basics-2Ankit Dubey
 
Networking
NetworkingNetworking
Networkingnik.manjit
 
Basic Networking in Java
Basic Networking in JavaBasic Networking in Java
Basic Networking in Javasuraj pandey
 
Unit-4 networking basics in java
Unit-4 networking basics in javaUnit-4 networking basics in java
Unit-4 networking basics in javaAmol Gaikwad
 
Mail Server Project Report
Mail Server Project ReportMail Server Project Report
Mail Server Project ReportKavita Sharma
 
Application Layer and Socket Programming
Application Layer and Socket ProgrammingApplication Layer and Socket Programming
Application Layer and Socket Programmingelliando dias
 
Network Programming-Python-13-8-2023.pptx
Network Programming-Python-13-8-2023.pptxNetwork Programming-Python-13-8-2023.pptx
Network Programming-Python-13-8-2023.pptxssuser23035c
 
Tcp/ip server sockets
Tcp/ip server socketsTcp/ip server sockets
Tcp/ip server socketsrajshreemuthiah
 
Socket Programming it-slideshares.blogspot.com
Socket  Programming it-slideshares.blogspot.comSocket  Programming it-slideshares.blogspot.com
Socket Programming it-slideshares.blogspot.comphanleson
 
Client server chat application
Client server chat applicationClient server chat application
Client server chat applicationSamsil Arefin
 
IPT Chapter 2 Web Services and Middleware - Dr. J. VijiPriya
IPT Chapter 2 Web Services and Middleware - Dr. J. VijiPriyaIPT Chapter 2 Web Services and Middleware - Dr. J. VijiPriya
IPT Chapter 2 Web Services and Middleware - Dr. J. VijiPriyaVijiPriya Jeyamani
 
Networking
NetworkingNetworking
NetworkingTuan Ngo
 

Ähnlich wie Md13 networking (20)

Unit 8 Java
Unit 8 JavaUnit 8 Java
Unit 8 Java
 
A.java
A.javaA.java
A.java
 
5_6278455688045789623.pptx
5_6278455688045789623.pptx5_6278455688045789623.pptx
5_6278455688045789623.pptx
 
Network programming in java - PPT
Network programming in java - PPTNetwork programming in java - PPT
Network programming in java - PPT
 
Module 1 networking basics-2
Module 1   networking basics-2Module 1   networking basics-2
Module 1 networking basics-2
 
Networking
NetworkingNetworking
Networking
 
Networking
NetworkingNetworking
Networking
 
Basic Networking in Java
Basic Networking in JavaBasic Networking in Java
Basic Networking in Java
 
Unit-4 networking basics in java
Unit-4 networking basics in javaUnit-4 networking basics in java
Unit-4 networking basics in java
 
Mail Server Project Report
Mail Server Project ReportMail Server Project Report
Mail Server Project Report
 
Socket
SocketSocket
Socket
 
Os 2
Os 2Os 2
Os 2
 
Application Layer and Socket Programming
Application Layer and Socket ProgrammingApplication Layer and Socket Programming
Application Layer and Socket Programming
 
Network Programming-Python-13-8-2023.pptx
Network Programming-Python-13-8-2023.pptxNetwork Programming-Python-13-8-2023.pptx
Network Programming-Python-13-8-2023.pptx
 
Java 1
Java 1Java 1
Java 1
 
Tcp/ip server sockets
Tcp/ip server socketsTcp/ip server sockets
Tcp/ip server sockets
 
Socket Programming it-slideshares.blogspot.com
Socket  Programming it-slideshares.blogspot.comSocket  Programming it-slideshares.blogspot.com
Socket Programming it-slideshares.blogspot.com
 
Client server chat application
Client server chat applicationClient server chat application
Client server chat application
 
IPT Chapter 2 Web Services and Middleware - Dr. J. VijiPriya
IPT Chapter 2 Web Services and Middleware - Dr. J. VijiPriyaIPT Chapter 2 Web Services and Middleware - Dr. J. VijiPriya
IPT Chapter 2 Web Services and Middleware - Dr. J. VijiPriya
 
Networking
NetworkingNetworking
Networking
 

Mehr von Rakesh Madugula

New features and enhancement
New features and enhancementNew features and enhancement
New features and enhancementRakesh Madugula
 
Md11 gui event handling
Md11 gui event handlingMd11 gui event handling
Md11 gui event handlingRakesh Madugula
 
Md10 building java gu is
Md10 building java gu isMd10 building java gu is
Md10 building java gu isRakesh Madugula
 
Md09 multithreading
Md09 multithreadingMd09 multithreading
Md09 multithreadingRakesh Madugula
 
Md08 collection api
Md08 collection apiMd08 collection api
Md08 collection apiRakesh Madugula
 
Md07 exceptions&assertion
Md07 exceptions&assertionMd07 exceptions&assertion
Md07 exceptions&assertionRakesh Madugula
 
Md06 advance class features
Md06 advance class featuresMd06 advance class features
Md06 advance class featuresRakesh Madugula
 
Md02 - Getting Started part-2
Md02 - Getting Started part-2Md02 - Getting Started part-2
Md02 - Getting Started part-2Rakesh Madugula
 
A begineers guide of JAVA - Getting Started
 A begineers guide of JAVA - Getting Started A begineers guide of JAVA - Getting Started
A begineers guide of JAVA - Getting StartedRakesh Madugula
 

Mehr von Rakesh Madugula (13)

New features and enhancement
New features and enhancementNew features and enhancement
New features and enhancement
 
Md121 streams
Md121 streamsMd121 streams
Md121 streams
 
Md11 gui event handling
Md11 gui event handlingMd11 gui event handling
Md11 gui event handling
 
Md10 building java gu is
Md10 building java gu isMd10 building java gu is
Md10 building java gu is
 
Md09 multithreading
Md09 multithreadingMd09 multithreading
Md09 multithreading
 
Md08 collection api
Md08 collection apiMd08 collection api
Md08 collection api
 
Md07 exceptions&assertion
Md07 exceptions&assertionMd07 exceptions&assertion
Md07 exceptions&assertion
 
Md06 advance class features
Md06 advance class featuresMd06 advance class features
Md06 advance class features
 
Md05 arrays
Md05 arraysMd05 arrays
Md05 arrays
 
Md04 flow control
Md04 flow controlMd04 flow control
Md04 flow control
 
Md03 - part3
Md03 - part3Md03 - part3
Md03 - part3
 
Md02 - Getting Started part-2
Md02 - Getting Started part-2Md02 - Getting Started part-2
Md02 - Getting Started part-2
 
A begineers guide of JAVA - Getting Started
 A begineers guide of JAVA - Getting Started A begineers guide of JAVA - Getting Started
A begineers guide of JAVA - Getting Started
 

KĂŒrzlich hochgeladen

Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptxJoelynRubio1
 
Philosophy of china and it's charactistics
Philosophy of china and it's charactisticsPhilosophy of china and it's charactistics
Philosophy of china and it's charactisticshameyhk98
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
Basic Intentional Injuries Health Education
Basic Intentional Injuries Health EducationBasic Intentional Injuries Health Education
Basic Intentional Injuries Health EducationNeilDeclaro1
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
80 ĐỀ THI THỏ TUYỂN SINH TIáșŸNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỏ TUYỂN SINH TIáșŸNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỏ TUYỂN SINH TIáșŸNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỏ TUYỂN SINH TIáșŸNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...Nguyen Thanh Tu Collection
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024Elizabeth Walsh
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxannathomasp01
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxPooja Bhuva
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxJisc
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxUmeshTimilsina1
 

KĂŒrzlich hochgeladen (20)

Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx
 
Philosophy of china and it's charactistics
Philosophy of china and it's charactisticsPhilosophy of china and it's charactistics
Philosophy of china and it's charactistics
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Basic Intentional Injuries Health Education
Basic Intentional Injuries Health EducationBasic Intentional Injuries Health Education
Basic Intentional Injuries Health Education
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
80 ĐỀ THI THỏ TUYỂN SINH TIáșŸNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỏ TUYỂN SINH TIáșŸNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỏ TUYỂN SINH TIáșŸNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỏ TUYỂN SINH TIáșŸNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 

Md13 networking

  • 2.
  • 3. Introduction Computers running on the Internet communicate with each other using TCP or UDP protocols 1. TCP/IP IP stands for Internet protocol, it’s a datagram protocol, which means transmitted packets of information are not guaranteed to be delivered. IP is a connectionless protocol. Since IP packets are never guaranteed to arrive at their destination, a higher level protocol TCP is used to provide a service that guarantees delivery
  • 4. Application that require a reliable point to point channel to communicate use TCP to communicate. Examples Hypertext Transfer Protocol (HTTP), File Transfer Protocol(FTP) , and Telnet. User Datagram Protocol(UDP) UDP is protocol that send independent packets of data called datagram from one computer to another with no guarantee about the arrival. UDP is not connection based like TCP, rather it sends independent packets of data called datagrams from one application to another.
  • 5. Sockets Sockets are software interfaces that connect an application to a network. On the Internet each machine has 65536 addressable ports it can use. Server programs listen to these ports for any incoming service request. A client program needs to open a port of its own before it can connect to a server port at the other end. The port numbers range from 0 to 1023 are restricted. They are reserved for use by well known services such as HTTP and FTP
  • 6.
  • 7. Internet Addressing * Every computer on the Internet has an address. * An Internet address is a number that uniquely identifies each computer on the Net. * Originally, all Internet addresses consisted of 32-bit values, also known as IPv4 (Internet Protocol, version 4). * IPv6 uses a 128-bit value to represent an address, so it supports a much larger address space writing, * IPv6 is not supported by all environments.
  • 8. There are 32 bits in an IPv4 IP address, and we often refer to them as a sequence of four numbers between 0 and 255 separated by dots (.). Domain Naming Service (DNS) * Refer to the addresses as numbers, is difficult, like http://192.9.9.1/ . * So it is mapped to name www.osborne.com that makes it easy to remember.
  • 9.
  • 10.
  • 11.
  • 12. static InetAddress[ ] getAllByName(String hostName) throws UnknownHostException This method returns an array of InetAddresses that represent all of the addresses that a particular name resolves to. Example InetAddressTest.java
  • 13. TCP Sockets There are two kinds of TCP sockets in Java. One is for servers, and the other is for clients. The ServerSocket class is designed to be a “listener,” which waits for clients to connect before doing anything. The Socket class is designed to connect to server sockets and initiate protocol exchanges. The creation of a Socket object implicitly establishes a connection between the client and server .
  • 14. Example Whois.java * Opens a connection to a port on the InterNIC server * Sends the command-line argument down the socket, and then prints the data that is returned * InterNIC will try to look up the argument as a registered Internet domain name, then send back the IP address and contact information for that site.
  • 15. URL The URL provides a reasonably intelligible form to uniquely identify or address information on the Internet. Every browser uses them to identify information on the Web. Examples of URLs are http://www.osborne.com/ and http://www.osborne.com:80/index.htm A URL specification is based on four components. The first is the protocol to use, separated from the rest of the locator by a colon (:). Common protocols are http, ftp,
  • 16. The second component is the host name or IP address of the host to use. The third component, the port number, is an optional parameter, The fourth part is the actual file path. Java’s URL class has got methods that gives information about the URL. Example URLDemo.java
  • 17. Communication with Remote Systems using TCP TCP is used to implement reliable, bidirectional, persistent connections between hosts on the Internet. The java.net package provide two classes that allow you to create two kind of sockets. The classes are Socket and ServerSocket. Socket class The Socket class is used to create the client sockets, is designed to connect to server socket and initiate the protocol exchange. When we create the Socket object it implicitly establishes the connection between the client and the server.
  • 18. It is not possible to get the details of establishing that connection because the Socket class does not provide any method for this purpose. Socket (String hostName, int port) This constructor is used to create a client socket and connect the local host to the specified hostName and port. Socket (InetAddress ipAddress, int port) This constructor is used to create a client socket using a Pre-existing InetAddress object and a port. There should be two ports for all TCP connections: a port on the remote machine a port on local machine through which the client communicates.
  • 19. ServerSocket class basically used to create the server sockets, is designed to be a listener, which wait for client to connect before doing anything. The ServerSocket class is used to create servers that listen for either Local or remote client to connect to them on standard ports. Constructors in ServerSocket class ServerSocket (int port) throws IOException This constructor is used to create the server socket on the specified port with default queue length of 50 Queue length Each server socket object is associated with queue length attribute which tell the system how many client Connection it can leave pending before it can simply refuse connection
  • 20. ServerSocket (int port, int queueLength) throws IOException This constructor is used to create a server socket on the Specified port with a specified queue length.
  • 21. Writing Client/Server using TCP To write the server program use the following steps 1.Create a server socket and begin listening. 2.Call the accept method to get new connection. 3.Create the input and output stream for the returned socket. 4.Conduct the conversation based on agreed protocol. 5.Close the client streams and socket. 6.Go back to step 2 or continue the step 7. 7.Close the server socket
  • 22. To write the client use the following steps 1.Create the client socket connection. 2.Acquire the read and write streams for the socket. 3.Use the streams according to the server’s protocol. 4.Close the streams. 5.Close the socket.
  • 23. Communicating with remote systems using UDP UDP cannot guarantee whether the sent or received datagrams reach at their destinations. UDP is mainly useful to broadcast low value information on a frequent basis, so that losing a communication does not effect the service. The java.net package provides two classes namely DatagramPacket And DatagramSocket to communicate with remote systems.
  • 24. DatagramPacket class is used to implement a connectionless packet delivery service. This class define two constructors DatagramPacket(byte[]buf, int length) This constructor is used for receiving data over a DatagramSocket. DatagramPacket(byte[]buf, int length, InetAddress address, int port) This constructor is used for transmitting datagrams,this requires destination machine address and the port number apart from the buffer and the size parameters.
  • 25. DatagramSocket class The DatagramSocket class provides the functionality for sending and receiving the datagrams. This class defines three constructors DatagramSocket() Construct a datagram socket and bind it to any available port on the local host machine. DatagramSocket(int port) Construct a datagram socket and bind it to the specified port on the local host machine. DatagramSocket(int port, InetAddress Iaddr) Construct a datagram socket and bind it to the specified local address.
  • 26. Writing Client/Server System using UDP To write a server using UDP follow the following steps 1.Create the datagram socket on a specific port. 2.Invoke the receive() method to wait for incoming packets. 3.According to the agreed protocol respond to received packets. 4.Repeat step 2 or continue to step 5. 5.Close the datagram socket. Example UDPServer.java
  • 27. To write a Client using UDP follow the following basic steps 1.Create the datagram socket on any available port. 2.Create the address to send data. 3.Send the data according to the Server’s protocol. 4.Wait for incoming data 5.Go back to step 3 or step 4 or go to step 6 6.Close the datagram socket. Example UDPClient.java