Hi David,
before you start to implement your P2P Network, you should have a look on how simulations are configurated and started in the simulator:
Simulations in PeerfactSim.Kom are configured using a simple xml-file.
Please consider "chord.xml" in folder "config/visualization", which is structured as follows:
- First, you can specify variables you want to use in this config-xml-file.
- Next, you define and configure different layers you want to use: NetLayer, Translayer, Overlay, Application, and Monitor
- Most Important: with the HostBuilder you define how many nodes to simulate and what layers each host/group comprises
- As a last step you can choose between different churnmodels, and select an "actions-file"
In the actions file (here: config/visualization/chord-actions.dat) you can specify actions, a specific group should perform at given time
(Be aware that all nodes in the group perform this action.)
Note that actions in the action-file (in "chord-actions.dat": startLookups or ...:join) are implemented in the "component"- or "additionalClasses" you select in the xml-file (last few lines in "chord.xml")
As next step you can implement your P2P Application/Overlay.
Have a look into the file I attached to this method, there you find a basis you can use for your application.
Most important: applications have to register to the transport layer in order to be able to receive messages.
Also have a look at other applications or overlays that are implemented, e.g.
org.peerfact.impl.overlay.dht.chord.chord.components.ChordNode and
org.peerfact.impl.overlay.dht.chord.chord.components.ChordNodeFactory
(A Factory is used to install an application/overlay on your simulated host....)
Further, you should have a look at org.peerfact.impl.overlay.dht.chord.chord.callbacks.joinOperation in order to learn how operations are used to send messages around.
- Make shure you understand how operations are executed and stopped (see org.peerfact.impl.common.AbstractOperation)
- Try to understand how callbacks (org.peerfact.api.common.OperationCallback) are used in combination with (Abstract)operations.
Operations can implement a "TransMessageCallback" to be able to receive messages and to wait for a message for a given time.
- Have a look at org.peerfact.api.transport.TransLayer: there you find all different send messages you can use to send(and wait for) a message.
If you follow these steps and if you have a look at existing Chord or Gnutella implementation, you have all the basics to implement your own application.
Hope this helps...