server socket. The server can use only one well-known port at a time for communication, but there are several client connections open at the same time that requires the pres- ence of several ports. To overcome this problem the server issues several ephemeral ports along with the well-known port. The connection made to the well-known Server Client Socket Socket Listen Connect Accept Receive Receive Close Close Figure 26.5 Connection oriented communication. Socket Communication port is assigned to the temporary port SO that the data transfer takes place between the temporary port at the client site and the temporary port at the server site. This helps to free the well-known port SO that the server can make a connection with another client. Connection Oriented (TCP) 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> void main (void) int responseListenID; int responseAcceptID; socklen t clientAddrLen; struct sockaddress serverAddr; struct sockaddress clientAddr; /* Create Socket * / responseListenID = socket (AF_INET, SOCK (STREAM, memset (&serverAddr, 0, sizeof (serverAddr) ) i /* define port (selectedPort) to use for listening * / serverAddr.sin_family = AF INET; serverAddr.sin port = htons (selectedPort) ; serverAddr.sin addr.s addr = htonl (INADDR ANY) ; /* Bind the socket */ bind (responseListenID, &serverAddr, sizeof (serverAddr)) /* Listen for connect request from client */ listen (responseListenID, 1) ; clientAddrLen = sizeof (clientAddr) ; /* define infinite "for" loop to accept connections from client * / for (i i) /* accept response from client */ Fundamentals of EMS, NMS and OSS/BSS responseAcceptID = accept (responseListenID,&clientAddr, &clientAddrLen) ; /* fork to handle multiple client request as separate process*/ pid = fork ( ) ; if (pid>0) /* this is the parent process of fork operation * / close (responseAcceptID) ; continue; /* this is the child process and needs to handle the