public class JavaCPN extends java.lang.Object implements JavaCPNInterface
No connection management has been implemented within Java/CPN as
this is a minimal implementation, however the important thing is that
it implements the same protocol at the Messaging Layer as the peer
functions have been provided at
the level of the Messaging Layer, meaning that sequences of bytes are
passed to the send method and returned from the receive method. The
methods have been provided at
the level of the Communication Layer from Comms/CPN. The
deliberate attempt was made to make the interface as close to that of
Comms/CPN as possible.
Methods external to the Java/CPN class must be used to convert from data (i.e. a string) into a ByteArrayInputStream object, and from a ByteArrayOutputStream object back into data. This is akin to the encoding and decoding functions passed into the send and receive functions of the Connection Management Layer in Comms/CPN. They are contained within the EncodeDecode class.
|Constructor and Description|
Constructor to create a new JavaCPN object.
|Modifier and Type||Method and Description|
Method to passively open a connection.
Method to actively establish a connection.
Method to disconnect the established connection.
Method used to receive a ByteArrayOutputStream from an established connection.
Method used to send a ByteArrayInputStream via an established connection.
acceptmethods need to be called.
public void connect(java.lang.String hostName, int port) throws java.io.IOException, java.net.UnknownHostException
hostName- The host to attempt to connect to
port- The port number to attempt to connect to
java.io.IOException- Thrown when there is a communication error
java.net.UnknownHostException- Thrown when the host name provided as the argument cannot be resolved into an IP address
public void accept(int port) throws java.io.IOException
public void send(java.io.ByteArrayInputStream sendBytes) throws java.net.SocketException
public java.io.ByteArrayOutputStream receive() throws java.net.SocketException
public void disconnect() throws java.io.IOException
Copyright © 2004-2014 The YAWL Foundation.