Skip to content

create_static_agent

Tushar Semwal edited this page Oct 15, 2017 · 1 revision

Syntax:

create_static_agent(Agent_name,(IP,Port),Handler).  

Agent_name: <atom ? > IP: <atom +>, Port: <integer +> Handler: <atom + >

Creates a static agent within the platform specified by the IP and Port, confers it a name and allocates its handler.

Description:

This predicate creates a static agent with the name Agent_name given by the user. It allocates the handler (which is a predicate specified by the user) Handler. The agent is created in the platform running at the IP and Port specified within. This predicate automatically creates the agent-specific predicates and asserts them within the specified platform. If the platform already contains an agent with the same name, it overwrites the same with this new agent having the specified name and handler.

Example:

?- create_static_agent(myagent, (localhost, 4545), function). 
?- create_static_agent (Agent_name, (localhost, 4545), function). 

In 1., the predicate creates all the agent-specific predicates and asserts them within the platform running on the localhost at port 4545. The agent name is myagent. In the second example, the name of the agent is unbound. The predicate automatically calls get_new_name_alpha/1 and then assigns a new name to this agent.

Clone this wiki locally