r; /* Create Socket * / commSocket = socket (AF INET, SOCK STREAM, 0) ; memset (&servAddr, 0, sizeof (hostAddr) ) ; hostAddr.sin_family = AF_INET; /* define port (selectedPort) to use connection */ hostAddr.sin_port = htons (selectedPort) /* define domain name (address) */ hptr = gethostbyname ("address") ; memcpy ( (char*) &hostAddr.sin_addr.s_addr,hptr->h_addr list [0] hptr->h_length) ; /* connect to server */ connect (commSocket, hostAddr, sizeof struct sockaddress) ; memset (buf, 0, DATABUF) ; /* Have a loop to send and receive information * / while (gets (buf) ) /* Implement read and write, for communication with server */ close (commSocket) 26.8 Client Server Implementation for Connectionless Protocol Communication The connectionless iterative server processes a single request at a time and uses a connectionless transport layer protocol like UDP. During the process of accept- ing, processing, and sending the request the server does not attend to other packets. The following activities are performed by the server in a connectionless protocol communication (see Figure 26.6): Server creates a server socket. Server binds with the socket. Server sends and receives messages with the client. Server closes the connection. Fundamentals of EMS, NMS and OSS/BSS Server Client Socket Socket Recv from Send to Send to Recv from Close Close Figure 26.6 Connectionless protocol. The following activities are performed by client in connectionless protocol communication: Client creates a client socket. Client binds with the socket. Client sends and receives messages with the server. Client closes the socket connection with server. Connectionless (UDP) Server Program /* Include Header files */ #include <sys/types.h> #include <sys/socket.h> #include <netdb.h> #include <netinet/in.h> #include <stdio.h> #include <string.h Socket Communication /* Define size of buffer * / #define DATABUF 512 void main (void) char buf [DATABUF] ; int socketID; socklen t addrLen; struct sockaddress serverAddr; /* Create Socket * / socketID = socket (A