Register   Login   About   Study   Enterprise   Share
AI / Internet Technology University (AITU)
Fast Login - available after registration







|

Top Links: >> 80. Technology >> Internet Technology Summit Program >> 3. Threads and Network
Current Topic: 3.2. Network
Sub-Topics: 3.2.1. Sockets | 3.2.2. Client Socket Example | 3.2.3. Server Socket Example | 3.2.4. Server Socket providing services | 3.2.5. Http Access | 3.2.6. Web page reader | 3.2.7. Writing to the web.
-- Scroll to check for more content below...
You have a privilege to create a quiz (QnA) related to this subject and obtain creativity score...
3.2. Network

Java networking is based on TCP/IP protocol. TCP/IP (Transmission Control Protocol/Internet Protocol) is the basic communication agreement or protocol of the Internet.

The same protocol is usually used for our local private networks, called intranet.

What is the Internet?
The Internet is a network of networks of connected computers.
Each computer on the Internet has an address, called IP address. Internet computers also called servers.
Created initially by DoD in 1960 and commercialized in 1990, the Internet grew rapidly and still continue growing including more and more mobile and Internet of Things (IoT) devices.
Each operating system, each computer, and each device that need to access the Internet has a program that implements TCP/IP protocol.

There are three basic features in TCP/IP protocol. (Of course there are many others including multi-layer architecture, but we will discuss the most important parts.)

1. TCP/IP protocol takes into account that connections are not always reliable and can be broken during the transmission of a message, which can be, for example, a huge downloadable file.
So, TCP/IP protocol allows an implementation program to break big messages into much smaller pieces, called packets, and send each packet separately.
2. A sender waits for a confirmation from a recipient that the packet was received and then sends the next packet.
3. What is a packet? TCP/IP packet is a following sequence of information:
- TCP/IP headers that include
o IP address of a recipient, for example, 216.6.180.125
o IP address of a sender, for example, 98.138.253.109
o Number of bytes in the coming message
- Message data
Note that four bytes of the address information (32 bits) represent IP protocol version 4 or IPv4.
IPv4 is slowly replaced with Internet Protocol version 6 (IPv6) which extends the address space to 128 bits, eight groups of four hexadecimal digits. IPv6 solves the long-anticipated problem that about 4.5 billion IP addresses covered by IPv4 will not be enough.

IPv6 address will look like that: 2015:0db8:85a3:0042:0986:8a2e:0670:1324
In Java TCP/IP protocol is implemented with the software called Sockets.

What are sockets?

Sockets are services at the end point of communication links.
We can exchange data between processes by transferring data through the socket. The most common use of sockets is as network connectors.
Was it clear so far?

Two types of sockets are implemented in Java:
TCP/IP sockets running over the Internet Protocol (TCP/IP).
The basic features of TCP/IP sockets:
- They are connection oriented services transferring data without record boundaries.
- According to TCP/IP protocol the socket software is waiting for confirmation from a recipient.
- The process will be informed when connection is broken.

Datagram sockets called also UDP sockets provide access to Unreliable Datagram
Protocol (UDP). UDP is a broadcast protocol that does not guarantee the reception of its messages.
- Datagram sockets are light weight sockets.
- UDP sockets do not check for confirmation from a recipient, so they are faster than TCP/IP sockets, often used for broadcasting information to multiple clients

TCP/IP is the base protocol for Internet communications. There are several higher level protocols that work on the top of TCP/IP to send and receive more specific types of information provided with specific applications that implement these protocols.

HTTP – Hypertext Transfer Protocol is implemented by Web Servers and Web Clients – browsers as the basis for web communications
FTP - File Transfer Protocol
SMTP - Simple Mail Transfer Protocol
TELNET - the remote terminal connection

Each protocol includes TCP/IP headers and message and adds their own headers.
For example, HTTP includes the headers that describe the nature of the message, such as:
Content-Type: text/html or Content-Type: image/jpg or Content-Length: 345678
See more information on HTTP headers here: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html


Java implements TCP/IP sockets with the following classes in the java.net package:
- Socket that serves as the client side of the connection
- ServerSocket that serves as the server side of the connection

The sockets are network connectors. Similar to file connectors, they also get connections to Input/Output streams
Once socket connection is established sockets data can be transferred with IO stream classes.


HTTP or Web communications are done with Url and UrlConnection classes, which also serve as network connectors and collaborate with Input/Output streams to transfer data.
Topic Graph | Check Your Progress | Propose QnA | Have a question or comments for open discussion?

Have a suggestion? - shoot an email
Looking for something special? - Talk to me
Read: IT of the future: AI and Semantic Cloud Architecture | Fixing Education
Do you want to move from theory to practice and become a magician? Learn and work with us at Internet Technology University (ITU) - JavaSchool.com.

Technology that we offer and How this works: English | Spanish | Russian | French

Internet Technology University | JavaSchool.com | Copyrights © Since 1997 | All Rights Reserved
Patents: US10956676, US7032006, US7774751, US7966093, US8051026, US8863234
Including conversational semantic decision support systems (CSDS) and bringing us closer to The message from 2040
Privacy Policy