| Client-Server Application Model | ||
|
Programs written to use TCP are developed using the client-server model. As mentioned previously, when two programs wish to use TCP to exchange data, one of the programs must assume the role of the client, while the other must assume the role of the server. The client application initiates what is called an active open. It creates a socket and actively attempts to connect to a server program. On the other hand, the server application creates a socket and passively listens for incoming connections from clients, performing what is called a passive open. When the client initiates a connection, the server is notified that some process is attempting to connect with it. By accepting the connection, the server completes what is called a virtual circuit, a logical communications pathway between the two programs. It’s important to note that the act of accepting a connection creates a new socket; the original socket remains unchanged so that it can continue to be used to listen for additional connections. When the server no longer wishes to listen for connections, it closes the original passive socket. To review, there are five significant steps that a program which uses TCP must take to establish and complete a connection. The server side would follow these steps:
In the case of the client, these steps are followed:
Only steps two and three are different, depending on if it’s a client or server application. |
||
|
Copyright © 2008 Catalyst Development Corporation. All rights reserved. |
||