projectinfosearch
Class AgentSender

java.lang.Object
  |
  +--projectinfosearch.AgentSender

public class AgentSender
extends java.lang.Object

An AgentSender can create and send out an agent and wait for its return.


Constructor Summary
AgentSender()
          creates an AgentSender
 
Method Summary
 void queryResult(int g)
          This method creates a ServerSocket which waits on the homePort.
 void sendAgent(java.net.InetAddress serverAddr, int serverPort, int homePort)
          Opens a TCP connection to a specified AgentServer, creates an AgentObject and sends it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AgentSender

public AgentSender()
creates an AgentSender
Method Detail

sendAgent

public void sendAgent(java.net.InetAddress serverAddr,
                      int serverPort,
                      int homePort)
Opens a TCP connection to a specified AgentServer, creates an AgentObject and sends it. If a connection problem occurs, "A server has crushed, it's too dangerous to send an agent!" is printed out and the apllicaation quits
Parameters:
serverAddr - is the InetAddress address of the AgentServer
serverPort - is the server port of the AgentServer
homePort - is the home port of the AgentClient

queryResult

public void queryResult(int g)
This method creates a ServerSocket which waits on the homePort. When an AgentServer wants to send home an AgentObject, a TCP connection is established and the agent extracted. The results of the agent's journey are printed and the application quits.
Parameters:
g - is the number of servers which were detected with the discovery client