SlideShare a Scribd company logo
Internet Address
Devices connected to the Internet are called nodes. Nodes that are
computers are called hosts. Each node or host is identified by at least one
unique 32-bit number called an Internet address, an IP address, or a host
address, depending on who you talk to. This takes up exactly four bytes of
memory.
An IP address is normally written as four unsigned bytes, each ranging
from to 255, with the most significant byte first. Bytes are separated by
periods for the convenience of human eyes. For example, the address for
hermes.oit.unc.edu is 152.2.21.1. This is called the dotted quad format.
IP addresses are great for computers, but they are a problem for humans,
who have a hard time remembering long numbers. In the 1950s, it was
discovered that most people could remember about seven digits per
number; some can remember as many as nine, while others remember
as few as five.
This is why phone numbers are broken into three- and four-digit pieces
with three-digit area codes. Obviously an IP address, which can have as
many as 12 decimal digits, is beyond the capacity of most humans to
remember.
Domain Name System (DNS)
To avoid the need to carry around Rolodexes full of IP addresses, the
designers of the Internet invented the Domain Name System (DNS).
DNS associates hostnames that humans can remember (like
hermes.oit.unc.edu) with IP addresses that computers can remember
(such as 152.2.21.1).[2] Most hosts have at least one hostname. An
exception is made for computers that don't have a permanent IP
address (like many PCs); since these computers don't have a
permanent address, they can't be used as servers and therefore don't
need a name, since nobody will need to refer to them.
Every computer connected to the Internet should have access to a
machine called a domain name server.
Unix box running special DNS software that knows the mappings
between different hostnames and IP addresses.
InetAddress Class
The java.net.InetAddress class is Java's encapsulation of an IP address.
It is used by most of the other networking classes, including Socket,
ServerSocket, URL, DatagramSocket, DatagramPacket, and more.
public final class InetAddress extends Object implements Serializable
There are no public constructors in the InetAddress class. However,
InetAddress has three static methods that return suitably initialized
InetAddress objects, given a little information. They are:
public static InetAddress InetAddress.getByName(String hostName)
throws UnknownHostException
public static InetAddress[] InetAddress.getAllByName(String
hostName)
throws UnknownHostException
public static InetAddress InetAddress.getLocalHost( )
throws UnknownHostException
import java.net.*;
public class OReillyByAddress {
public static void main (String[] args)
{
try {
InetAddress address =
InetAddress.getByName("204.148.40
.9");
System.out.println (address);
}
catch (UnknownHostException e) {
System.out.println ("Could not find
204.148.40.9");
}
}
}
% java OReillyByAddress
helio.ora.com/204.148.40.9
import java.net.*;
public class OReillyByName {
public static void main (String[]
args) {
try {
InetAddress address =
InetAddress.getByName("www.ore
illy.com");
System.out.println(address);
}
catch (UnknownHostException e) {
System.out.println("Could not find
www.oreilly.com");
}
}
}
% java OReillyByName
www.oreilly.com/204.148.40.9
Find the address of the local machine
Activity
import java.net.*;
public class MyAddress {
public static void main (String[] args) {
try {
InetAddress address =
InetAddress.getLocalHost( );
System.out.println(address);
}
catch (UnknownHostException e) {
System.out.println("Could not find this
computer's address.");
}
}
}
Socket programming
Sockets for Clients
A socket is a connection between two hosts.
Operations
The program creates a new socket with a Socket ( )
constructor.
The socket attempts to connect to the remote host.
Once the connection is established, the local and remote
hosts get input and output streams from the socket and use
those streams to send data to each other. This connection is
full-duplex; both hosts can send and receive data
simultaneously.
When the transmission of data is complete, one or both
sides close the connection.
Constructors
1. public Socket (String host, int port) throws
UnknownHostException, IOException
This constructor creates a TCP socket to the specified port
on the specified host and attempts to connect to the
remote host.
2. public Socket(InetAddress host, int port) throws
IOException
This constructor creates a TCP socket to the specified port
on the specified host and tries to connect. It differs by
using an InetAddress object to specify the host rather than
a hostname.
Write a program for
Find out which of the Ports at or Above 1,024
Seem to Be Hosting TCP Server
Datagram Packet
UDP datagram is represented by an instance of the DatagramPacket
class public final class DatagramPacket extends Object
Constructors
Receiving datagram
1. public DatagramPacket(byte[] buffer, int length)
When a socket receives a datagram, it stores the datagram's data part
in buffer beginning at buffer[0] and continuing until the packet is
completely stored or until length bytes have been written into the
buffer.
2. public DatagramPacket(byte[] buffer, int offset, int length)
When a socket receives a datagram, it stores the datagram's data part
in buffer beginning at buffer[offset] and continuing until the packet is
completely stored or until length bytes have been written into the
buffer.
Sending datagram
1. public DatagramPacket(byte[] data, int length, InetAddress
destination, int port)
2. public DatagramPacket(byte[] data, int offset, int length,
InetAddress destination, int port)
Each constructor creates a new DatagramPacket to be sent to
another host. The packet is filled with length bytes of the data array
starting at offset or if offset is not used. If you try to construct a
DatagramPacket with a length that is greater than data.length, the
constructor throws an IllegalArgumentException.
Example: 1
A java program establishes socket connection
between two hosts. The connection is
maintained through the mentioned port number
to implement client server communication.
E-mail Client
An email client, email reader, or more formally mail user agent
(MUA), is a computer program used to manage email.
The term email client may refer to any agent acting as a client
toward an email server, regardless of it being a mail user agent, a
relaying server, or a human typing on a terminal.
A web application providing message management, composition,
and reception functionality is sometimes considered an email
client.
Retrieving messages from a mailbox
Like most client programs, an MUA is only active when a user runs
it. Messages arrive on the Mail Transfer Agent (MTA) server.
Unless the MUA has access to the server's disk, messages are
stored on a remote server and the MUA has to request them on
behalf of the user.
In the first case, shared disk, a user logs on a server and runs an
MUA on that machine. The MUA reads messages from a
conventionally formatted storage, typically mbox, within the user's
HOME directory.
The MTA uses a suitable mail delivery agent (MDA) to add
messages to that storage, possibly in concurrence with the MUA.
This is the default setting on many UNIX systems. Web mail
applications running on the relevant server can also benefit from
direct disk access to the mail storage.
For personal computing, and whenever messages are stored on a
remote system, a mail user agent connects to a remote mailbox to
retrieve messages.
Formatting messages
Submitting messages to a server
Encryption
Encryption of mail sessions
Encryption of the message body
Standards
Port numbers
Activity
Web page retrieval
To locate and retrieve data from the network is to use
the URL class.
Write a program to Download a Web Page using java
import java.

More Related Content

What's hot

Socket
SocketSocket
Networking
NetworkingNetworking
NetworkingTuan Ngo
 
Socket programming-in-python
Socket programming-in-pythonSocket programming-in-python
Socket programming-in-python
Yuvaraja Ravi
 
Networking in python by Rj
Networking in python by RjNetworking in python by Rj
internet protocol
internet protocolinternet protocol
internet protocol
rajshreemuthiah
 
Unit-4 networking basics in java
Unit-4 networking basics in javaUnit-4 networking basics in java
Unit-4 networking basics in java
Amol Gaikwad
 
Multiplayer Java Game
Multiplayer Java GameMultiplayer Java Game
Multiplayer Java Game
karim baidar
 
Whole c++ lectures ITM1 Th
Whole c++ lectures ITM1 ThWhole c++ lectures ITM1 Th
Whole c++ lectures ITM1 Th
Aram Mohammed
 
The Internet and World Wide Web
The Internet and World Wide WebThe Internet and World Wide Web
The Internet and World Wide Webwebhostingguy
 
Web design EJ3
Web design    EJ3Web design    EJ3
Web design EJ3
Aram Mohammed
 
Python Sockets
Python SocketsPython Sockets
Python Sockets
pythontic
 
vishal_sharma: python email sending software
vishal_sharma: python email sending software  vishal_sharma: python email sending software
vishal_sharma: python email sending software
vishal sharma
 
Network programming in Java
Network programming in JavaNetwork programming in Java
Network programming in Java
Tushar B Kute
 
Inter process communication
Inter process communicationInter process communication
Inter process communicationPradeep Kumar TS
 
Java 1
Java 1Java 1
Python network programming
Python   network programmingPython   network programming
Python network programming
Learnbay Datascience
 
socket programming
socket programming socket programming
socket programming
prashantzagade
 

What's hot (20)

Socket
SocketSocket
Socket
 
Networking
NetworkingNetworking
Networking
 
Socket programming-in-python
Socket programming-in-pythonSocket programming-in-python
Socket programming-in-python
 
Networking in python by Rj
Networking in python by RjNetworking in python by Rj
Networking in python by Rj
 
internet protocol
internet protocolinternet protocol
internet protocol
 
Unit-4 networking basics in java
Unit-4 networking basics in javaUnit-4 networking basics in java
Unit-4 networking basics in java
 
Multiplayer Java Game
Multiplayer Java GameMultiplayer Java Game
Multiplayer Java Game
 
Ipc
IpcIpc
Ipc
 
Whole c++ lectures ITM1 Th
Whole c++ lectures ITM1 ThWhole c++ lectures ITM1 Th
Whole c++ lectures ITM1 Th
 
The Internet and World Wide Web
The Internet and World Wide WebThe Internet and World Wide Web
The Internet and World Wide Web
 
Web design EJ3
Web design    EJ3Web design    EJ3
Web design EJ3
 
Python Sockets
Python SocketsPython Sockets
Python Sockets
 
vishal_sharma: python email sending software
vishal_sharma: python email sending software  vishal_sharma: python email sending software
vishal_sharma: python email sending software
 
Java
JavaJava
Java
 
Network programming in Java
Network programming in JavaNetwork programming in Java
Network programming in Java
 
Ipc in linux
Ipc in linuxIpc in linux
Ipc in linux
 
Inter process communication
Inter process communicationInter process communication
Inter process communication
 
Java 1
Java 1Java 1
Java 1
 
Python network programming
Python   network programmingPython   network programming
Python network programming
 
socket programming
socket programming socket programming
socket programming
 

Viewers also liked

Hertz
HertzHertz
2012 grand hyatt taipei presentation
2012 grand hyatt taipei presentation2012 grand hyatt taipei presentation
2012 grand hyatt taipei presentationvacationUSA
 
Hertz 租車
Hertz 租車Hertz 租車
Hertz 租車
vacationUSA
 
美國阿拉斯加州
美國阿拉斯加州美國阿拉斯加州
美國阿拉斯加州
vacationUSA
 
美國愛達荷州亞太區辦事處
美國愛達荷州亞太區辦事處美國愛達荷州亞太區辦事處
美國愛達荷州亞太區辦事處
vacationUSA
 
2012.10.11 我的美國主題樂園之旅記者會
2012.10.11 我的美國主題樂園之旅記者會2012.10.11 我的美國主題樂園之旅記者會
2012.10.11 我的美國主題樂園之旅記者會vacationUSA
 
Java API: java.net.InetAddress
Java API: java.net.InetAddressJava API: java.net.InetAddress
Java API: java.net.InetAddress
Sayak Sarkar
 

Viewers also liked (10)

Inet
InetInet
Inet
 
Hertz
HertzHertz
Hertz
 
2012 grand hyatt taipei presentation
2012 grand hyatt taipei presentation2012 grand hyatt taipei presentation
2012 grand hyatt taipei presentation
 
Hertz 租車
Hertz 租車Hertz 租車
Hertz 租車
 
達美航空
達美航空達美航空
達美航空
 
Premium outlets
Premium outletsPremium outlets
Premium outlets
 
美國阿拉斯加州
美國阿拉斯加州美國阿拉斯加州
美國阿拉斯加州
 
美國愛達荷州亞太區辦事處
美國愛達荷州亞太區辦事處美國愛達荷州亞太區辦事處
美國愛達荷州亞太區辦事處
 
2012.10.11 我的美國主題樂園之旅記者會
2012.10.11 我的美國主題樂園之旅記者會2012.10.11 我的美國主題樂園之旅記者會
2012.10.11 我的美國主題樂園之旅記者會
 
Java API: java.net.InetAddress
Java API: java.net.InetAddressJava API: java.net.InetAddress
Java API: java.net.InetAddress
 

Similar to Session 6

Network programming in java - PPT
Network programming in java - PPTNetwork programming in java - PPT
Network programming in java - PPT
kamal kotecha
 
Mail Server Project Report
Mail Server Project ReportMail Server Project Report
Mail Server Project ReportKavita Sharma
 
Internet, Intranet & Extranet & IP and MAC
Internet, Intranet & Extranet & IP and MACInternet, Intranet & Extranet & IP and MAC
Internet, Intranet & Extranet & IP and MAC
Asmita Singh
 
Networking Java Socket Programming
Networking Java Socket ProgrammingNetworking Java Socket Programming
Networking Java Socket ProgrammingMousmi Pawar
 
maXbox Arduino Tutorial
maXbox Arduino TutorialmaXbox Arduino Tutorial
maXbox Arduino Tutorial
Max Kleiner
 
GSBA - IT Orientation Program by Prof. Amit Chandra
GSBA - IT Orientation Program by Prof. Amit ChandraGSBA - IT Orientation Program by Prof. Amit Chandra
GSBA - IT Orientation Program by Prof. Amit Chandra
Amit Chandra
 
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
VijiPriya Jeyamani
 
How Internet Works
How Internet WorksHow Internet Works
How Internet Works
sumit kumar
 
Network programming in Java
Network programming in JavaNetwork programming in Java
Network programming in Java
Tushar B Kute
 
How does the internet work
How does the internet workHow does the internet work
How does the internet work
mraheel205
 
Network Programming in Java
Network Programming in JavaNetwork Programming in Java
Network Programming in Java
Tushar B Kute
 
Networking slide
Networking slideNetworking slide
Networking slide
Asaduzzaman Kanok
 
Networking And Internet
Networking And InternetNetworking And Internet
Networking And Internet
susantai89
 
Linux Systems Prograramming: Unix Domain, Internet Domain (TCP, UDP) Socket P...
Linux Systems Prograramming: Unix Domain, Internet Domain (TCP, UDP) Socket P...Linux Systems Prograramming: Unix Domain, Internet Domain (TCP, UDP) Socket P...
Linux Systems Prograramming: Unix Domain, Internet Domain (TCP, UDP) Socket P...
RashidFaridChishti
 
Published on IST 554 (httpsonline.ist.psu.eduist554).docx
Published on IST 554 (httpsonline.ist.psu.eduist554).docxPublished on IST 554 (httpsonline.ist.psu.eduist554).docx
Published on IST 554 (httpsonline.ist.psu.eduist554).docx
amrit47
 
Pears
PearsPears
Pearsthips
 
Understanding computer networks
Understanding computer networksUnderstanding computer networks
Understanding computer networks
UC San Diego
 
Application layer
Application layerApplication layer
Application layer
reshmadayma
 

Similar to Session 6 (20)

Network programming in java - PPT
Network programming in java - PPTNetwork programming in java - PPT
Network programming in java - PPT
 
Mail Server Project Report
Mail Server Project ReportMail Server Project Report
Mail Server Project Report
 
Unit 8 Java
Unit 8 JavaUnit 8 Java
Unit 8 Java
 
28 networking
28  networking28  networking
28 networking
 
Internet, Intranet & Extranet & IP and MAC
Internet, Intranet & Extranet & IP and MACInternet, Intranet & Extranet & IP and MAC
Internet, Intranet & Extranet & IP and MAC
 
Networking Java Socket Programming
Networking Java Socket ProgrammingNetworking Java Socket Programming
Networking Java Socket Programming
 
maXbox Arduino Tutorial
maXbox Arduino TutorialmaXbox Arduino Tutorial
maXbox Arduino Tutorial
 
GSBA - IT Orientation Program by Prof. Amit Chandra
GSBA - IT Orientation Program by Prof. Amit ChandraGSBA - IT Orientation Program by Prof. Amit Chandra
GSBA - IT Orientation Program by Prof. Amit Chandra
 
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
 
How Internet Works
How Internet WorksHow Internet Works
How Internet Works
 
Network programming in Java
Network programming in JavaNetwork programming in Java
Network programming in Java
 
How does the internet work
How does the internet workHow does the internet work
How does the internet work
 
Network Programming in Java
Network Programming in JavaNetwork Programming in Java
Network Programming in Java
 
Networking slide
Networking slideNetworking slide
Networking slide
 
Networking And Internet
Networking And InternetNetworking And Internet
Networking And Internet
 
Linux Systems Prograramming: Unix Domain, Internet Domain (TCP, UDP) Socket P...
Linux Systems Prograramming: Unix Domain, Internet Domain (TCP, UDP) Socket P...Linux Systems Prograramming: Unix Domain, Internet Domain (TCP, UDP) Socket P...
Linux Systems Prograramming: Unix Domain, Internet Domain (TCP, UDP) Socket P...
 
Published on IST 554 (httpsonline.ist.psu.eduist554).docx
Published on IST 554 (httpsonline.ist.psu.eduist554).docxPublished on IST 554 (httpsonline.ist.psu.eduist554).docx
Published on IST 554 (httpsonline.ist.psu.eduist554).docx
 
Pears
PearsPears
Pears
 
Understanding computer networks
Understanding computer networksUnderstanding computer networks
Understanding computer networks
 
Application layer
Application layerApplication layer
Application layer
 

More from Parthipan Parthi

Inheritance
Inheritance Inheritance
Inheritance
Parthipan Parthi
 
Switch statement mcq
Switch statement  mcqSwitch statement  mcq
Switch statement mcq
Parthipan Parthi
 
Oprerator overloading
Oprerator overloadingOprerator overloading
Oprerator overloading
Parthipan Parthi
 
802.11 mac
802.11 mac802.11 mac
802.11 mac
Parthipan Parthi
 
Ieee 802.11 wireless lan
Ieee 802.11 wireless lanIeee 802.11 wireless lan
Ieee 802.11 wireless lan
Parthipan Parthi
 
Computer network
Computer networkComputer network
Computer network
Parthipan Parthi
 
Ieee 802.11 wireless lan
Ieee 802.11 wireless lanIeee 802.11 wireless lan
Ieee 802.11 wireless lan
Parthipan Parthi
 
Queuing analysis
Queuing analysisQueuing analysis
Queuing analysis
Parthipan Parthi
 
WAP
WAPWAP
Alternative metrics
Alternative metricsAlternative metrics
Alternative metrics
Parthipan Parthi
 
Ieee 802.11 wireless lan
Ieee 802.11 wireless lanIeee 802.11 wireless lan
Ieee 802.11 wireless lan
Parthipan Parthi
 
Io stream
Io streamIo stream
Io stream
Parthipan Parthi
 
Dbms lab questions
Dbms lab questionsDbms lab questions
Dbms lab questions
Parthipan Parthi
 
REVERSIBLE DATA HIDING WITH GOOD PAYLOAD DISTORTIONPpt 3
REVERSIBLE DATA HIDING WITH GOOD PAYLOAD DISTORTIONPpt 3 REVERSIBLE DATA HIDING WITH GOOD PAYLOAD DISTORTIONPpt 3
REVERSIBLE DATA HIDING WITH GOOD PAYLOAD DISTORTIONPpt 3
Parthipan Parthi
 

More from Parthipan Parthi (20)

Inheritance
Inheritance Inheritance
Inheritance
 
Switch statement mcq
Switch statement  mcqSwitch statement  mcq
Switch statement mcq
 
Oprerator overloading
Oprerator overloadingOprerator overloading
Oprerator overloading
 
802.11 mac
802.11 mac802.11 mac
802.11 mac
 
Ieee 802.11 wireless lan
Ieee 802.11 wireless lanIeee 802.11 wireless lan
Ieee 802.11 wireless lan
 
Computer network
Computer networkComputer network
Computer network
 
Ieee 802.11 wireless lan
Ieee 802.11 wireless lanIeee 802.11 wireless lan
Ieee 802.11 wireless lan
 
Queuing analysis
Queuing analysisQueuing analysis
Queuing analysis
 
WAP
WAPWAP
WAP
 
Alternative metrics
Alternative metricsAlternative metrics
Alternative metrics
 
Ethernet
EthernetEthernet
Ethernet
 
Ieee 802.11 wireless lan
Ieee 802.11 wireless lanIeee 802.11 wireless lan
Ieee 802.11 wireless lan
 
Data structures1
Data structures1Data structures1
Data structures1
 
Data structures 4
Data structures 4Data structures 4
Data structures 4
 
Data structures2
Data structures2Data structures2
Data structures2
 
Data structures 3
Data structures 3Data structures 3
Data structures 3
 
Input output streams
Input output streamsInput output streams
Input output streams
 
Io stream
Io streamIo stream
Io stream
 
Dbms lab questions
Dbms lab questionsDbms lab questions
Dbms lab questions
 
REVERSIBLE DATA HIDING WITH GOOD PAYLOAD DISTORTIONPpt 3
REVERSIBLE DATA HIDING WITH GOOD PAYLOAD DISTORTIONPpt 3 REVERSIBLE DATA HIDING WITH GOOD PAYLOAD DISTORTIONPpt 3
REVERSIBLE DATA HIDING WITH GOOD PAYLOAD DISTORTIONPpt 3
 

Recently uploaded

This 7-second Brain Wave Ritual Attracts Money To You.!
This 7-second Brain Wave Ritual Attracts Money To You.!This 7-second Brain Wave Ritual Attracts Money To You.!
This 7-second Brain Wave Ritual Attracts Money To You.!
nirahealhty
 
guildmasters guide to ravnica Dungeons & Dragons 5...
guildmasters guide to ravnica Dungeons & Dragons 5...guildmasters guide to ravnica Dungeons & Dragons 5...
guildmasters guide to ravnica Dungeons & Dragons 5...
Rogerio Filho
 
The+Prospects+of+E-Commerce+in+China.pptx
The+Prospects+of+E-Commerce+in+China.pptxThe+Prospects+of+E-Commerce+in+China.pptx
The+Prospects+of+E-Commerce+in+China.pptx
laozhuseo02
 
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
3ipehhoa
 
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
eutxy
 
Multi-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and GuidelinesMulti-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Sanjeev Rampal
 
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdfJAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
Javier Lasa
 
How to Use Contact Form 7 Like a Pro.pptx
How to Use Contact Form 7 Like a Pro.pptxHow to Use Contact Form 7 Like a Pro.pptx
How to Use Contact Form 7 Like a Pro.pptx
Gal Baras
 
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
3ipehhoa
 
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
keoku
 
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
ufdana
 
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
3ipehhoa
 
BASIC C++ lecture NOTE C++ lecture 3.pptx
BASIC C++ lecture NOTE C++ lecture 3.pptxBASIC C++ lecture NOTE C++ lecture 3.pptx
BASIC C++ lecture NOTE C++ lecture 3.pptx
natyesu
 
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC
 
Latest trends in computer networking.pptx
Latest trends in computer networking.pptxLatest trends in computer networking.pptx
Latest trends in computer networking.pptx
JungkooksNonexistent
 
1.Wireless Communication System_Wireless communication is a broad term that i...
1.Wireless Communication System_Wireless communication is a broad term that i...1.Wireless Communication System_Wireless communication is a broad term that i...
1.Wireless Communication System_Wireless communication is a broad term that i...
JeyaPerumal1
 
Internet-Security-Safeguarding-Your-Digital-World (1).pptx
Internet-Security-Safeguarding-Your-Digital-World (1).pptxInternet-Security-Safeguarding-Your-Digital-World (1).pptx
Internet-Security-Safeguarding-Your-Digital-World (1).pptx
VivekSinghShekhawat2
 
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptxBridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Brad Spiegel Macon GA
 
test test test test testtest test testtest test testtest test testtest test ...
test test  test test testtest test testtest test testtest test testtest test ...test test  test test testtest test testtest test testtest test testtest test ...
test test test test testtest test testtest test testtest test testtest test ...
Arif0071
 
History+of+E-commerce+Development+in+China-www.cfye-commerce.shop
History+of+E-commerce+Development+in+China-www.cfye-commerce.shopHistory+of+E-commerce+Development+in+China-www.cfye-commerce.shop
History+of+E-commerce+Development+in+China-www.cfye-commerce.shop
laozhuseo02
 

Recently uploaded (20)

This 7-second Brain Wave Ritual Attracts Money To You.!
This 7-second Brain Wave Ritual Attracts Money To You.!This 7-second Brain Wave Ritual Attracts Money To You.!
This 7-second Brain Wave Ritual Attracts Money To You.!
 
guildmasters guide to ravnica Dungeons & Dragons 5...
guildmasters guide to ravnica Dungeons & Dragons 5...guildmasters guide to ravnica Dungeons & Dragons 5...
guildmasters guide to ravnica Dungeons & Dragons 5...
 
The+Prospects+of+E-Commerce+in+China.pptx
The+Prospects+of+E-Commerce+in+China.pptxThe+Prospects+of+E-Commerce+in+China.pptx
The+Prospects+of+E-Commerce+in+China.pptx
 
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
 
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
 
Multi-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and GuidelinesMulti-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and Guidelines
 
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdfJAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
 
How to Use Contact Form 7 Like a Pro.pptx
How to Use Contact Form 7 Like a Pro.pptxHow to Use Contact Form 7 Like a Pro.pptx
How to Use Contact Form 7 Like a Pro.pptx
 
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
 
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
 
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
 
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
 
BASIC C++ lecture NOTE C++ lecture 3.pptx
BASIC C++ lecture NOTE C++ lecture 3.pptxBASIC C++ lecture NOTE C++ lecture 3.pptx
BASIC C++ lecture NOTE C++ lecture 3.pptx
 
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
 
Latest trends in computer networking.pptx
Latest trends in computer networking.pptxLatest trends in computer networking.pptx
Latest trends in computer networking.pptx
 
1.Wireless Communication System_Wireless communication is a broad term that i...
1.Wireless Communication System_Wireless communication is a broad term that i...1.Wireless Communication System_Wireless communication is a broad term that i...
1.Wireless Communication System_Wireless communication is a broad term that i...
 
Internet-Security-Safeguarding-Your-Digital-World (1).pptx
Internet-Security-Safeguarding-Your-Digital-World (1).pptxInternet-Security-Safeguarding-Your-Digital-World (1).pptx
Internet-Security-Safeguarding-Your-Digital-World (1).pptx
 
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptxBridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
 
test test test test testtest test testtest test testtest test testtest test ...
test test  test test testtest test testtest test testtest test testtest test ...test test  test test testtest test testtest test testtest test testtest test ...
test test test test testtest test testtest test testtest test testtest test ...
 
History+of+E-commerce+Development+in+China-www.cfye-commerce.shop
History+of+E-commerce+Development+in+China-www.cfye-commerce.shopHistory+of+E-commerce+Development+in+China-www.cfye-commerce.shop
History+of+E-commerce+Development+in+China-www.cfye-commerce.shop
 

Session 6

  • 1. Internet Address Devices connected to the Internet are called nodes. Nodes that are computers are called hosts. Each node or host is identified by at least one unique 32-bit number called an Internet address, an IP address, or a host address, depending on who you talk to. This takes up exactly four bytes of memory. An IP address is normally written as four unsigned bytes, each ranging from to 255, with the most significant byte first. Bytes are separated by periods for the convenience of human eyes. For example, the address for hermes.oit.unc.edu is 152.2.21.1. This is called the dotted quad format. IP addresses are great for computers, but they are a problem for humans, who have a hard time remembering long numbers. In the 1950s, it was discovered that most people could remember about seven digits per number; some can remember as many as nine, while others remember as few as five. This is why phone numbers are broken into three- and four-digit pieces with three-digit area codes. Obviously an IP address, which can have as many as 12 decimal digits, is beyond the capacity of most humans to remember.
  • 2. Domain Name System (DNS) To avoid the need to carry around Rolodexes full of IP addresses, the designers of the Internet invented the Domain Name System (DNS). DNS associates hostnames that humans can remember (like hermes.oit.unc.edu) with IP addresses that computers can remember (such as 152.2.21.1).[2] Most hosts have at least one hostname. An exception is made for computers that don't have a permanent IP address (like many PCs); since these computers don't have a permanent address, they can't be used as servers and therefore don't need a name, since nobody will need to refer to them. Every computer connected to the Internet should have access to a machine called a domain name server. Unix box running special DNS software that knows the mappings between different hostnames and IP addresses.
  • 3. InetAddress Class The java.net.InetAddress class is Java's encapsulation of an IP address. It is used by most of the other networking classes, including Socket, ServerSocket, URL, DatagramSocket, DatagramPacket, and more. public final class InetAddress extends Object implements Serializable There are no public constructors in the InetAddress class. However, InetAddress has three static methods that return suitably initialized InetAddress objects, given a little information. They are: public static InetAddress InetAddress.getByName(String hostName) throws UnknownHostException public static InetAddress[] InetAddress.getAllByName(String hostName) throws UnknownHostException public static InetAddress InetAddress.getLocalHost( ) throws UnknownHostException
  • 4. import java.net.*; public class OReillyByAddress { public static void main (String[] args) { try { InetAddress address = InetAddress.getByName("204.148.40 .9"); System.out.println (address); } catch (UnknownHostException e) { System.out.println ("Could not find 204.148.40.9"); } } } % java OReillyByAddress helio.ora.com/204.148.40.9 import java.net.*; public class OReillyByName { public static void main (String[] args) { try { InetAddress address = InetAddress.getByName("www.ore illy.com"); System.out.println(address); } catch (UnknownHostException e) { System.out.println("Could not find www.oreilly.com"); } } } % java OReillyByName www.oreilly.com/204.148.40.9
  • 5. Find the address of the local machine Activity import java.net.*; public class MyAddress { public static void main (String[] args) { try { InetAddress address = InetAddress.getLocalHost( ); System.out.println(address); } catch (UnknownHostException e) { System.out.println("Could not find this computer's address."); } } }
  • 6. Socket programming Sockets for Clients A socket is a connection between two hosts. Operations The program creates a new socket with a Socket ( ) constructor. The socket attempts to connect to the remote host. Once the connection is established, the local and remote hosts get input and output streams from the socket and use those streams to send data to each other. This connection is full-duplex; both hosts can send and receive data simultaneously. When the transmission of data is complete, one or both sides close the connection.
  • 7. Constructors 1. public Socket (String host, int port) throws UnknownHostException, IOException This constructor creates a TCP socket to the specified port on the specified host and attempts to connect to the remote host. 2. public Socket(InetAddress host, int port) throws IOException This constructor creates a TCP socket to the specified port on the specified host and tries to connect. It differs by using an InetAddress object to specify the host rather than a hostname.
  • 8. Write a program for Find out which of the Ports at or Above 1,024 Seem to Be Hosting TCP Server
  • 9. Datagram Packet UDP datagram is represented by an instance of the DatagramPacket class public final class DatagramPacket extends Object Constructors Receiving datagram 1. public DatagramPacket(byte[] buffer, int length) When a socket receives a datagram, it stores the datagram's data part in buffer beginning at buffer[0] and continuing until the packet is completely stored or until length bytes have been written into the buffer. 2. public DatagramPacket(byte[] buffer, int offset, int length) When a socket receives a datagram, it stores the datagram's data part in buffer beginning at buffer[offset] and continuing until the packet is completely stored or until length bytes have been written into the buffer.
  • 10. Sending datagram 1. public DatagramPacket(byte[] data, int length, InetAddress destination, int port) 2. public DatagramPacket(byte[] data, int offset, int length, InetAddress destination, int port) Each constructor creates a new DatagramPacket to be sent to another host. The packet is filled with length bytes of the data array starting at offset or if offset is not used. If you try to construct a DatagramPacket with a length that is greater than data.length, the constructor throws an IllegalArgumentException.
  • 11. Example: 1 A java program establishes socket connection between two hosts. The connection is maintained through the mentioned port number to implement client server communication.
  • 12. E-mail Client An email client, email reader, or more formally mail user agent (MUA), is a computer program used to manage email. The term email client may refer to any agent acting as a client toward an email server, regardless of it being a mail user agent, a relaying server, or a human typing on a terminal. A web application providing message management, composition, and reception functionality is sometimes considered an email client.
  • 13. Retrieving messages from a mailbox Like most client programs, an MUA is only active when a user runs it. Messages arrive on the Mail Transfer Agent (MTA) server. Unless the MUA has access to the server's disk, messages are stored on a remote server and the MUA has to request them on behalf of the user. In the first case, shared disk, a user logs on a server and runs an MUA on that machine. The MUA reads messages from a conventionally formatted storage, typically mbox, within the user's HOME directory. The MTA uses a suitable mail delivery agent (MDA) to add messages to that storage, possibly in concurrence with the MUA. This is the default setting on many UNIX systems. Web mail applications running on the relevant server can also benefit from direct disk access to the mail storage. For personal computing, and whenever messages are stored on a remote system, a mail user agent connects to a remote mailbox to retrieve messages.
  • 14. Formatting messages Submitting messages to a server Encryption Encryption of mail sessions Encryption of the message body Standards Port numbers
  • 15. Activity Web page retrieval To locate and retrieve data from the network is to use the URL class. Write a program to Download a Web Page using java import java.