Você está na página 1de 4

Java Networking

Homogeneous Network: maintaining same types of architecture for every system in a


network. Like in the LAN network.

Heterogeneous Network: architecture may defer from one system to another system.
Internet is a Heterogeneous type of network.

Connection Oriented Communication: it is reliable communication as data will transfer


from one end to another end with consistent connection.

Connectionless communication: it is possible in the form of pocket routers which


exchange the data in packets. It is not reliable.

Protocol is a system of defining the rules and regulation in transferring the data in
networks. We can develop the application based on connection oriented and also
connection less protocols.

Example: - some of the connection oriented protocols.

HTTP (Hyper Test Transfer Protocol)


FTP (File Transfer Protocol)
SMTP (Simple Mail Transfer Protocol)
POP3 (Post Office Protocol)

Example: - some of the UDP connection less protocols.

DNS (Domain Naming Service)


RMI (Remote Method Invocation)
SNMP (Simple Network Management Protocol)

It is basic protocol standard for transferring the data. It will have 4 layers.

Transport Layer à data in streams (TCP/UDP)


Network Layer à data divides to packets (IP)
Link Layer à data into Frames (Error/Flow)
Physical Layer à Raw bits (Ethernet)
OPEN SYSTEM INTERCONNECT (OSI)

There are 7 layers in this model.

Application: - sends data in FTP, HTTP, SMTP, POP3.


Presentation: - presenting data in understandable format.
Session: - maintance connection (socket).
Transport Layer: - data in streams (TCP/UDP).
Network Layer: - data is divided to packets (IP).
Data Link Layer: - data into is divided into Frames (Error/Flow).
Physical Layer: - Raw bits (Ethernet).

TRANSMISSION CONTROL PROTOCOL/INTERNET PROTOCOL (TCP/IP)

There are only 4 layers in this model

Application; - combination of Application, presentation and Session Layers

Transport Layer: - data in streams (TCP/UDP).


Internet Layer: - data is divided to packets (IP).
Network Access: - combination of Data Link Physical Layers.

Applications Requirements: - A System without TCP/IP settings can not be used to


execute network based applications.
As Network Based Applications are developed on Application Layer protocols which are
the standards used in TCP/IP stack and it needs IPAddress to identify every system in
network.

Communication in between two systems either on TCP or UDP will be based on


IPAddress and Port number.

Network Based Application are developed either for distribution of data or for
exchanging the information.
These Applications can work among the hosts (Systems connected to network) and also
portable on internet also as both are based on TCP/IP protocol.
Applications can be developed for servers and clients but internally it has to depend on
protocols used in servers.

Client and Server: -

In Client/Server technology, an application which passes request of connection is called a


client application and an application which provides response on a request is called server
application.
Servers are different types based on their services and they will follow their individual
protocols like….
Web Server: http protocol
File Server: ftp protocol
Mail Serve: smtp/pop3 protocol

Domain: IT is a logical group of hosts or users. Every host connected to network has to
be part of domain. Example: .com, .org, .net, .gov, .in etc.

DNS (Domain Name System): - It is maintained by ISP. It is a logical name address for
physical number address. It resolves the user friendly name into physical IPAddress.
Within a DNS a name can be mapped to multiple IPAddresses.

TCP/IP Address: It is a 32 bit number used to identify the systems connected in network.
It can be called as Inet Address or Internet Address.
Format: (0-255). (0-255).(0-255).(0-255)
Example: 192.210.55.10
Static IPAddress: - address fixed to identify the host in network.
Loop Back Address: - (127.0.0.1) IT is used to identify the LocalHost. Every host will
two IP Addresses ie., one is assigned to identify host and another is to identify on its own.
It is used to refer to services of our own host.

Port: - A physical number which is used to identify the service.


Some of them are given.

URL: - Class URL represents a Uniform Resource Locator, a pointer to a "resource" on the
World Wide Web. A resource can be something as simple as a file or a directory, or it can
be a reference to a more complicated object, such as a query to a database or to a search
engine.

Here is an example of applet and also application.

Protocol is "language" used by 'net clients & servers’


URL class hides connection, communication Simpler interface, but less control over
connection.
Let's look at HTTP protocol as an example: - POP (77), and SMTP (104)
HTTP is a simple text based protocol
Client connects, sends a request, receives a response
Each request is independent (HTTP is stateless).

Request has three parts : command line, headers, data


First (command) line specifies:
Command (method): - GET, POST, HEAD, etc.
Resource : usually the path portion of the URL
Protocol version: - HTTP/1.0 or HTTP/1.1
Followed by request headers, ended with an empty line.
Name: value pairs with information about client.
Data follows for as upload or posted form information.
URLConnection: - The abstract class URLConnection is the superclass of all classes that
represent a communications link between the application and a URL. Instances of this
class can be used both to read from and to write to the resource referenced by the URL.
In general, creating a connection to a URL is a multi-step process:

Sockets are simply "endpoints" for network connections. Sockets are not "protocol-
oriented" like URL class. You're responsible for entire client-server conversation.
Java has two kinds of socket classes. TCP/IP sockets are "connection-oriented" extra
overhead for reliable data transfer.

A datagram socket is the sending or receiving point for a packet delivery service. Each
packet sent or received on a datagram socket is individually addressed and routed.
Multiple packets sent from one machine to another may be routed differently, and may
arrive in any order. Datagram sockets are "packet-oriented" don't require overhead of
connection setup.

Steps to connect to the client are explained: -

The client is the processor that initiates the connection


The server is the processor that accepts the connection
There may be no difference between them subsequently
The server has a port on which it listens for connection requests
The client creates a port and sends a request to the server’s port
It then establishes the connection between the server port and the client's port

All client socket connections contain the same six steps

1. Open a socket to the server


2. Open an input stream to the socket
3. Open an output stream to the socket
4. Read from and write to the stream according to the protocol agreed with the
server
5. Close the streams
6. Close the socket

Only step 4 differs from program, depending on the protocol agreed with the server

UDP Datagram socket: -

The UDP protocol provides a mode of network communication whereby datagrams are
sent over the network. DatagramSockets are used for the connection.
A datagram’s arrival, arrival time and order of arrival is not guaranteed. It’s used
whenever information needed to be broadcast periodically

Você também pode gostar