Webflow Tutorial


Developing Modules

Creating Ports

    All ports are derived from Port class . The main methods in the Port class are:

    A simple integer port has been used for the adder class . The basic integer port sends and recieves an Integer object since the send and receive functions of the Port class deal with the Object class . When the IntPort object is created, the constructor of the Port class is called which registers the port with the ConnectionManager and gives a unique portID to the port. This id is retrieved using the getPortID() method in the initialize method of the module . This portID is what is stored in the MetaModule and it is what is used for making connections between modules.

    The destroy method is used when the module terminates and is used to deregister the port.

    The send and recieve methods are implemented in the following way in the IntPort class 1.

  1. Send Method
  2. The send method as defined by the Port class takes an Object as its parameter:

    In the IntPort class this Object is an Integer object which contains the integer data to be transmitted through the port. To get the Socket of the port the getSocket method is called . A new output stream is created through which the data is sent:

  3. Recieve Method
  4. It returns an object of class Object:

    In the IntPort class this Object is an Integer object which contains integer data recieved . As usual the getSocket method retrieves the Socket and a new input stream is created through which data is read: