com.slamd.tools.tcpreplay
Class CaptureDaemon

java.lang.Object
  extended by com.slamd.tools.tcpreplay.CaptureDaemon

public class CaptureDaemon
extends java.lang.Object

This class defines a utility that may be used to capture data from one or more clients so that it may be replayed against a server later for the purpose of load generation. Any data captured will be forwarded onto the server and any response from that server will be passed back to the client.

Author:
Neil A. Wilson

Constructor Summary
CaptureDaemon(int listenPort, java.lang.String serverHost, int serverPort, java.lang.String outputFile)
          Creates a new capture daemon with the provided information.
 
Method Summary
 void captureData()
          Starts listening for new connections from clients.
 void stopCapture()
          Stops the process of capturing data from clients.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CaptureDaemon

public CaptureDaemon(int listenPort,
                     java.lang.String serverHost,
                     int serverPort,
                     java.lang.String outputFile)
              throws java.net.UnknownHostException
Creates a new capture daemon with the provided information.

Parameters:
listenPort - The port on which to listen for new connections from clients.
serverHost - The address of the server to which client requests should be forwarded.
serverPort - The port of the server to which client requests should be forwarded.
outputFile - The name of the file to which the captured data should be written.
Throws:
java.net.UnknownHostException - If the server address cannot be resolved to an IP address.
Method Detail

captureData

public void captureData()
                 throws java.io.IOException
Starts listening for new connections from clients. Whenever a connection arrives, it will be handed off to other threads for processing.

Throws:
java.io.IOException - If a problem occurs while creating the server socket to accept client connections or opening the output file to which to write the captured data.

stopCapture

public void stopCapture()
Stops the process of capturing data from clients.