* * README 9.2 92/07/01 11:06:27 * examples/c/tcp One programming model you may choose to use is a program that runs on your workstation and communicates with a program running on the nodes with TCP/IP calls. The workstation program uses TCP/IP calls to communicate with the node program. The workstation does not have to run the remote host software. Because TCP/IP has only a C interface, only a C version of this example is provided. In this example, the node program is a compute server. After being loaded, it waits at a socket for data from the workstation program. When it receives the data, the node program performs its calculation and returns an answer to the host. The user then has the option of killing the node program or returning it to the socket. The example calculates the value of pi, using an algorithm very similar to that used in the pi example. The example consists of two programs, tcpnode and tcphost. The program tcpnode runs on the nodes and acts as the compute server, and tcphost runs on the workstation. Once loaded on the nodes, tcpnode waits at a ssocket for a message from tcphost. When the message arrives, tcpnode performs the requested operation and returns an answer to tcphost. First tcphost requests information from the user. tcphost requests the number of quadratures and the number of nodes to use in the calculation. The number of nodes must be equal to or less than the number of nodes in the allocated partition. tcphost assumes that the tcpnode on node 0 is waiting at a TCP/IP socket. tcphost then writes the necessary startup information to a TCP/IP socket where it is read by node 0. Node 0 then uses NX/2 message passing calls to send the information to the other nodes in the partition. They perform the calculation, and each returns the answer, the value of pi, to node 0. Node 0 then writes the answer to the TCP/IP socket where it is read by tcphost and printed out on the screen. Node 0 returns to waiting at the socket. The user now has the option of terminating the node program at the end of your session or letting it run, ready for use by another invocation of tcphost.