F INET, SOCK DGRAM, 0) ; memset (&serverAddr, 0, sizeof (serverAddr)) ; serverAddr.sin family = AF INET; /* define port (selectedPort) to use connection */ serverAddr.sin port = htons (selectedPort) serverAddr.sin_addr.s_addr = htonl (INADDR ANY) ; /* Bind the Socket */ bind (socketID, &serverAddr, sizeof (serverAddr)) ; addrLen = sizeof (serverAddr) ; memset (buf, 0, DATABUF) ; /* Define infinite loop to send and receive data from client for (i i) /* The while loop is invoked when data is received */ while (recvfrom (socketID, buf, MAXBUF, 0, &clientAddr, &addrLen) >0) /* Implement function to process the received information * / /* Send data to the client * / sendto (socketID, buf, MAXBUF, 0, &clientAddr, &addrLen) ; memset (buf, 0, DATABUF) ; } /* end of while loop */ } /* end of for loop */ /* Close the socket connection */ close (socketID) ; Fundamentals of EMS, NMS and OSS/BSS Connectionless (UDP) Client 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 h> /* Define size of buffer */ #define DATABUF 512 void main (void) char buf [DATABUF] ; int socketID; socklen t remoteAddrLen; struct sockaddress remoteAddr; struct hostent *hptr; /* Create Socket */ socketID = socket (AF INET, SOCK DGRAM, 0) memset (&remoteAddr, 0, sizeof (remoteAddr)) ; remoteAddr.sin_family = AF INET; /* define port (selectedPort) to use connection */ remoteAddr.sin port = htons (selectedPort) /* define domain name (address) * / hptr = gethostbyname ("address") ; memcpy ( (char*) &remoteAddr.sin_addr.s_addr hptr->h_addr list [0], hptr->h_length) , memset (buf, 0, DATABUF) ; remoteAddrLen = sizeof (remoteAddr); / No need to bind if communication is not peer-to-peer * / while (gets (buf) ) Socket Communication /* send information to server * / sendto (socketID, buf, sizeof (buf), , 0, &remoteAddr, sizeof (remoteAddr) ) ; memset (buf, 0, sizeof (buf) ) ; /* receive information from server * / recvfrom (socketID, buf, DATABUF, 0