Dynamic proxy

The agents contain a list with information about computers on the network with agents and which can send messages to the Internet. These agents are called proxies.

When the list of proxies is empty or none of the agents in the list respond (availability = 0), the agent sends a message via broadcast to the subnet asking “Who is Proxy?” so that it can send a message to the Internet via a proxy.

When it is waiting for data from the list of valid proxies, the proxy module will not attend other requests.

The list of proxies has a value associated to each proxy with a maximum number of attempts to connect with another agent before it will be considered invalid. By default the number is three, and when this value reaches zero the agent will be considered invalid as a proxy.

If at any time all the proxies in the list are invalid, the list itself will be considered invalid and the search for proxies is launched through the message “Who is proxy?"

It is possible that the message is sent correctly to the proxy in the list, but the proxy discovers it does not have an Internet connection. In this case, the remote agent will repeat the sequence described here, resending the message to a proxy in the list, but it will also send via TCP a message to the agent that sent the message saying “I am not Proxy”, to indicate that it should be removed from the list as it does not have a connection to the Internet.

This process is repeated until the message is sent correctly to the Internet or it passes through a maximum number of proxies without managing to be sent, in which case the message is lost.

You can configure the maximum number of proxies through which a message can pass. By default, it will only be sent to one and if the attempt fails the message is lost.

The message contains a list of the proxies through which it has passed, to avoid being sent twice to the same proxy without Internet connection.