Send a suggestion!

We're building a brand new version of the site, and we'd love to hear your ideas

Members

Technology Zones

IBM Learning Center

Articles

Hosted By

MaximumASP

Info

Rated
Read 120,499 times

Contents

Related Categories

Introduction to TCP/IP - Client-Server Protocol

Client-Server Protocol

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:

  1. Create a socket.
  2. Listen for incoming connections from clients.
  3. Accept the client connection.
  4. Send and receive information.
  5. Close the socket when finished, terminating the conversation.

In the case of the client, these steps are followed:

  1. Create a socket.
  2. Specify the address and service port of the server program.
  3. Establish the connection with the server.
  4. Send and receive information.
  5. Close the socket when finished, terminating the conversation.

Only steps two and three are different, depending on if it’s a client or server application.

Comments

  • Re: [28] Introduction to TCP/IP

    Posted by drkarthik on 25 Aug 2006

    hi

    This is possible using threads in the client program. the client can generate parallel connections using threads. so u can create multiple clients in the same system.


    In the serv...

  • Re: [28] Introduction to TCP/IP

    Posted by msshweta on 05 Apr 2006

    hi i want to make socket connection for the multiple clients li...

  • Socket Application doubt

    Posted by Suganya on 06 Feb 2006

    Hi,

    Iam developing the socket application.In this the remote host is sending messages.But iam not able to pick all the messages sent by the remote host.If remote is sending 10 msgs,then iam able to...

  • help for all programmers needing client server app

    Posted by ranaasim on 15 Dec 2004

    there would b two applications one will be at server the other will be at client side
    i m sending this code asuming that u have some prior knowledge about network programming
    include this code at s...

  • Help

    Posted by Anu2000 on 27 Aug 2004

    Hi. I read ur message. I'm doing a (socket programming) chatty client/server messenger program too and I need lots of help. I heard you have done it. Could u send me ur source code and i could refer t...