next up previous contents
Next: Java RMI Up: Communication in Parallel Programming Previous: Communication in Parallel Programming   Contents


Java Sockets

The Java socket interface java.net provides two kinds of socket classes, the streams-based Socket class and the datagrams-based DatagramSocket class. A datagram is a low-level networking interface and uses a protocol called UDP (Unreliable Datagram Protocol) to tramsmit data. The Socket class allows programmers to connect to a specified port and read and write data using the InputStream and OutputStream of the java.io package. The DatagramSocket class uses DatagramPacket for data transmission and reception. Here the application creates a datagram packet with the source and destination addresses and the relevant data and uses send() and receive() to transmit data over the network.

The socket model is suitable for programming client-server applications. Typical scientific parallel programs do not fit directly into this model. Before a SPMD program can start two conditions must obtain: a pool of symmetric peer processes must have been created, and each peer must be able to address a message to any other.

Carpenter et al [#!Carpenter97!#] present a schematic outline of a distributed Conway's Game of Life program using Java socket interface. In this socket version example, they observed that

For reasons such as these, even with the simplified Java socket API, they concluded that direct socket programming will probably remain unattractive to scientific parallel programmers, even with the simplified Java socket API.


next up previous contents
Next: Java RMI Up: Communication in Parallel Programming Previous: Communication in Parallel Programming   Contents
Bryan Carpenter 2004-06-09