|Networking in Java|
Networking in Java Simplified:
Java.net package contains several classes to support networking.
Java supports Internet’s TCP /IP protocol.TCP is connection oriented and IP is connection less protocol.
TCP stands for Transmission Control Protocol. IP stands for Internet Protocol.Two communication protocols presents a connection oriented service. Just like a telephone. It first establishes a connection with remote machine. Once the connection has been established, they communicate data as part of communication. This protocol allows users to send and receive any amount of data without any boundaries. It also guarantees delivery of data.TCP allows us to send a packet to an individual machines on the internet that is multiple destinations addresses are allowed.TCP is more reliable but not efficient.
IP is a connection less transport service protocol. It is also said datagram protocol which means that data should be sent and received in individual packets.In this protocol, each IP packets travel on their own. Just like normal courier service or a postal letter.The delivery is not guaranteed.Packets may be duplicated,lost or received in a different orders.IP allows us to send a packet to an individual machine on the internet that is a single destination address is allowed.IP is more efficient but less reliable.
TCP/IP protocol is built on IP to achieve its functionalities and short comings of TCP with IP’s efficiency.
UDP stand for User Datagram Protocol . This came from the fact that IP is theoritically limited to sending a 64K byte packet,which is insufficient for sending many files or even large GIF images embedded in a webpage.To resolve this shortcoming of IP, one could break up the data stream into separate IP packets remembering them and then reassembling them on arrival. UDP is lie cross reference between IP and TCP. It is a datagram protocol with the same 64K packet size limit of IP but allows port addressed to be specific.
Java supports TCP and UDP protocol.