MaDKit forum

Welcome All !
Please, use explicit topic names when creating new threads. Thanks.

You are not logged in.

#1 Re: HowTo » How to create a distributed society? » 2018-02-12 14:43:21

I tested your version and it works also.

Benjamin

#2 Re: HowTo » How to create a distributed society? » 2018-01-30 17:18:38

Hello again,

I create a PingPongNet class extending the PingPong class as following:

public class PingPongNet extends PingPong {

	public String ip = "10.122.10.74"; 
	
	public void activate() {
		super.activate();
		getLogger().info("I just activated the agent");
    	
		try {
			this.sendMessage(LocalCommunity.NAME, Groups.SYSTEM, DefaultMaDKitRoles.GROUP_MANAGER_ROLE,
					new KernelMessage(KernelAction.CONNECT_TO_IP, InetAddress.getByName(ip)));
		} catch (UnknownHostException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	public static void main(String[] args) {
		String[] argss = { "--network", "--launchAgents", PingPongNet.class.getName(), ",true" };
		Madkit.main(argss);
	    }
}

And when I launch this agent, it automatically launch the network and also connect the kernel in which it is to the kernel having the IP stored in variable "ip" ... and it is work! Both agents interact and play ping-pong.

What do you think? Is it a good way to do it? Or something better is possible? I found the command to connect to another host in the class dealing with the menu of the GUI.

Benjamin

#3 Re: HowTo » How to create a distributed society? » 2018-01-30 12:19:16

fmichel wrote:

"launch network" starts the "network agent" and put the kernel online and thus make it available for receiving connections. It should also automatically connect to other kernels which are on the same LAN. "Connect to IP" is more about reaching hosts located on the WAN, but could also indeed be used to connect to any host thanks to its IP.

Hello,

OK, I launched to MaDKit platforms (kernels?) on two different computers. I launched one PingPong agent on each kernel and then I launched network on both. Then I connected one kernel to the other kernel with the "connect to IP" menu. And PingPong agent from one kernel succeed to automatically communicate with the PingPong agent from the other kernel. I launched more agents on both platforms and every agents played with all agents.

But I did that with the MaDKit Desktop (with the menu). Is it possible in the "main(String[] args)" (or somewhere else) of the PingPong java class to add a method or argument to make the kernel of the agent this object will launch connect automatically to another kernel (a kind of broker one) and have for instance:

public static void main(String[] args) {
    String[] argss = { "--network", "--launchAgents", "--connectToIP", "10.122.10.64", PingPong.class.getName(), ",true" };
    Madkit.main(argss);
}

Thanks for your time.

Benjamin

or

public static void main(String[] args) {
    executeThisAgent(1, true, "10.122.10.64");
}

#4 Re: HowTo » How to create a distributed society? » 2018-01-24 16:49:36

fmichel wrote:

Hello,

bgateau wrote:

Thanks for your answer. Just before checking your message, I saw in the Desktop instance of MaDKit 3 menu items dealing with network. Than I read your message.

MaDKit 3 ? You meant 5, right ?

I use MaDKit 5 indeed, but I meant that in the window of the MaDKit desktop, I saw 3 menu items: "launch network", "stop network" and "connect to IP" ! And I think that I will need to use the "connect to IP" command to make an agent of HOST1 (my laptop) able to communicate with agent of HOST2 (my desktop computer).

Benjamin

#5 Re: HowTo » How to create a distributed society? » 2018-01-24 16:11:49

Hello,

Thanks for your answer. Just before checking your message, I saw in the Desktop instance of MaDKit 3 menu items dealing with network. Than I read your message.

Unfortunately, I didn't success to execute your example. As you said, I launched two instances of MaDKit desktop, launched network on both instances and started a PingPong agent on each ... and nothing happened. They didn't communicate.

Besides, is there another way to launch network and connect two kernels (on the same host or not) without using an instance of the desktop. My goal is to launch an agent on a computer linked to the network and make it communicate with others agents on others hosts.

I will continue to investigate by firstly studying tutorials.

Regards

Benjamin

#6 HowTo » How to create a distributed society? » 2018-01-23 18:19:19

bgateau
Replies: 9

Hello,

I would like to know if it is possible to create a distributed society. I mean a society with agents on different hosts. And how to send message between those distributed agents?

Regards

Board footer