Package org.jacoco.agent.rt.internal.output

## Class TcpServerOutput

- java.lang.Object
- - org.jacoco.agent.rt.internal.output.TcpServerOutput

All Implemented Interfaces:
  `IAgentOutput`

    public class TcpServerOutput
    extends java.lang.Object
    implements IAgentOutput

Output that opens TCP server socket. This controller uses the following agent options:

- address
- port

### Constructor Summary

Constructors
`TcpServerOutput​(IExceptionLogger logger)` New controller instance.

### Method Summary

All Methods Instance Methods Concrete Methods
`protected java.net.ServerSocket` `createServerSocket​(AgentOptions options)` Open a server socket based on the given configuration.
`protected java.net.InetAddress` `getInetAddress​(java.lang.String address)` Returns the `InetAddress` object to open the server socket on.
`void` `shutdown()` Shutdown the agent controller and clean up any resources it has created.
`void` `startup​(AgentOptions options, RuntimeData data)` Configure the agent controller with the supplied options and connect it to the coverage runtime
`void` `writeExecutionData​(boolean reset)` Write all execution data in the runtime to a location determined by the agent controller.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### TcpServerOutput

    public TcpServerOutput​(IExceptionLogger logger)

New controller instance.

Parameters:
  `logger` - logger to use in case of exceptions is spawned threads

### Method Detail

#### startup

    public void startup​(AgentOptions options,
                        RuntimeData data)
                 throws java.io.IOException

Description copied from interface: `IAgentOutput`
Configure the agent controller with the supplied options and connect it to the coverage runtime

Specified by:
  `startup` in interface `IAgentOutput`
Parameters:
  `options` - Options used to configure the agent controller
  `data` - Execution data for this agent
Throws:
  `java.io.IOException`

#### shutdown

    public void shutdown()
                  throws java.lang.Exception

Description copied from interface: `IAgentOutput`
Shutdown the agent controller and clean up any resources it has created.

Specified by:
  `shutdown` in interface `IAgentOutput`
Throws:
  `java.lang.Exception` - in case shutdown fails

#### writeExecutionData

    public void writeExecutionData​(boolean reset)
                            throws java.io.IOException

Description copied from interface: `IAgentOutput`
Write all execution data in the runtime to a location determined by the agent controller. This method should only be called by the Agent

Specified by:
  `writeExecutionData` in interface `IAgentOutput`
Parameters:
  `reset` - if `true` execution data is cleared afterwards
Throws:
  `java.io.IOException` - in case writing fails

#### createServerSocket

    protected java.net.ServerSocket createServerSocket​(AgentOptions options)
                                                throws java.io.IOException

Open a server socket based on the given configuration.

Parameters:
  `options` - address and port configuration
Returns:
  opened server socket
Throws:
  `java.io.IOException`

#### getInetAddress

    protected java.net.InetAddress getInetAddress​(java.lang.String address)
                                           throws java.net.UnknownHostException

Returns the `InetAddress` object to open the server socket on.

Parameters:
  `address` - address specified as a string
Returns:
  address to open the server socket
Throws:
  `java.net.UnknownHostException`