How Sockets Can Be Used To Write Client-server Applications Using A Connection-oriented Client-server Technique

How Sockets Can Be Used To Write Client-server Applications Using A Connection-oriented Client-server Technique


  • 13 Feb, 2012

    Sockets can be used to write client-server applications using a connection-oriented client-server technique. Some characteristics of this technique include: * The server can handle multiple client requests for connection and service. * The server responds to any one client's request independently of all other clients. * A client knows how to establish a connection with the server. The client-server connection, when established, remains in existence until either the client or the server explicitly breaks it, much like a trouble-free telephone call. The socket used for this connection is called a connection-oriented socket.The socket type is specified as SOCK_STREAM. As a result, the process receiving a message processes that message by the following rules: * The data transmitted has no boundaries. * All bytes in a received message must be read before the next message can be processed. * Bytes in a received message can be read in a loop program control structure since no data bytes are discarded. * The server will usually fork() a child process upon establishment of a client connection. * This child server process is designed to communicate with exactly one client process. * The child server process performs the requested service for its connected client. * The child server process terminates when the service request has been completed. Functions listen() and accept() enable the server to listen for service requests. read() and write() may be used by client and server to send/receive messages; send() and recv() may also be used.

    Comments Received:
    Please give your suggestions and feedback:

2009-2016 downloadmela.com. All rights reserved.