TCP/IP, UDP & Multicasting Through Java's Socket
Since birth of network programming, it has been error-prone, difficult, and complex. The programmer had to know many details about the network and sometimes even the hardware. You usually needed to understand the various layers of the networking protocol, and there were a lot to different functions in each networking library concerned with connecting, packing, unpacking blocks of information, handshaking, etc. It was a difficult task. However, the concept of networking is not so difficult. You want to get some information from that machine over there and move it to this machine here, or vice-versa. Its quite similar to reading and writing files, except that the files exist on the remote machine.
One of Java's great strengths is painless networking. As much as possible, the underlying details of networking have been abstracted away. The programming model we use is that of the file programming model. In addition, Java's built-in multithreading is exceptionally handy when dealing with another networking issue: handling multiple connections at once. The java.net package includes classes that enable the programmer to easily pass data across networks.
The primary function of the TCP/IP is to provide a point to point communication mechanism. One process on one machine communicates with the another process on another machine or within the same machine. This communication appears as two streams of data. One stream carries data from one process to the other, while the other carries data in the other direction. Each process can read the data that have been written by the other, and in normal conditions, the data received are the same, and in the same order, as when they are sent.




