TCP is a Network Protocol which stands for Transfer Control Protocol, that allows well founded communication between applications. TCP is consistently used over the Internet Protocol, and that is why referred as TCP/IP. The communication mechanism between two systems, using TCP, can be established using Sockets and is known as Socket Programming. Hence, socket programming is a concept of Network Programming, that suggests to write programs that are executed across multiple systems, which are connected to each other using a network.
A client creates a socket at it’s end of transmission, and strive to connect the socket to server. When a connection is established, server creates a socket at it’s end and, client and server can now ready communicate through writing and reading methods. Following is the elaborated procedure of what happens when a TCP connection is established:
Now, communication is held using input/output streams of Sockets. The InputStream of client is coupled with the OutputStream of server and OutputStream of client is coupled with the InputStream of server. Since, TCP is a two-way network protocol, hence information can flow through both the streams at the time.
#tcp-ip #java #socket-programming #client-server #sockets