A peer to peer network emulator
Copy the J2J package from src/sample to your project. Import the package into the appropiate files
import J2J
Create a new object of type p2pNode. Constructor takes port number and IP address
p2pNode instance = new p2pNode(6066, 192.168.0.1);
//Replace 192.168.0.1 with the IP address of your destination computer
Call the connect() member function
instance.connect();
Call the connect() member function on both computers to connect
instance.connect()
To send a message to the other computer, use sendMessage(String). To receive a message, call fetchMessage()
instance.sendMessage("Hello there");
message = instance.fetchMessage();
Call instance.disconnet()
on both computers to drop off the connection