www.beck-ipc.com

Programming client server applications - SC12 @CHIP-RTOS V1.10


    IPC@CHIP Documentation Index

Client-Server

Programming client/server applications

Here is a short description for programming client/server applications with the TCP/IP API.
The most used methods for programming TCP/IP applications are client or server applications.

The term server applies to any process or program that offers a service that can be reached over the network.   Servers accept request that arrive over the network, perform their service, and return the result to the requester.   An example for the simplest service is the standard echo server application.   The server echoes the received data over the network back to the requester.   A process becomes a client when its sends a request to a server and waits for an answer.   the client-server model is the standard model for interprocess communication.   A TCP/IP stack provides two different methods for client-server connections:

1.UDP protocol:

This protocol realizes connectionless communication between a client and server, based on sending and receiving of single datagrams.

TCP/IP API calls for an UDP client:

  • Open a socket
  • Send an outgoing datagram usually a prerecorded endpoint address.
  • Receive the next incoming datagram and record its source endpoint address.
  • Close a socket


    TCP/IP API calls for an UDP server:

  • Open a socket
  • Bind a socket, assign an address to an unnamed socket
  • Receive the next incoming datagram and record its source endpoint address.
  • Send an outgoing datagram usually a prerecorded endpoint address.


    2.TCP protocol:

    The TCP protocol is a connection- and byte stream-oriented protocol

    TCP/IP API calls for a TCP client:

  • Open a socket
  • Connect to a remote peer
  • Send an outgoing stream of characters
  • Receive an outgoing stream of characters
  • Close a socket


    TCP/IP API calls for a TCP server:

  • Open a socket
  • Bind a socket, assign an address to an unnamed socket
  • Place the socket in a passive mode
  • Accept the next incoming connection
  • Receive an outgoing stream of characters
  • Send an outgoing stream of characters
  • Close a socket



    We provide several examples for programming client/server applications:
  • UDPEchoClient, udpclie.c, built with int86x calls
  • UDPEchoServer, udpserv.c, built with int86x calls
  • TCPEchoClient, tcpclie.c, built with int86x calls
  • TCPEchoServer, tcpserv.c, built with int86x calls
  • TCPEchoClient, tcpclie.c, built with C-API-functions, using tcpip.c
  • TCPEchoServer, tcpserv.c, built with C-API-functions, using tcpip.c


    Note:
    All program examples built with C-API-functions use the files TCPIP.C, TCPIP.H and TCPIPAPI.H.




    End of document