org.apache.jmeter.protocol.tcp.sampler

## Class TCPSampler

- java.lang.Object
- - org.apache.jmeter.testelement.AbstractTestElement
  - - org.apache.jmeter.samplers.AbstractSampler
    - - org.apache.jmeter.protocol.tcp.sampler.TCPSampler

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, ConfigMergabilityIndicator, Searchable, Interruptible, Sampler, TestElement, ThreadListener

      public class TCPSampler
      extends AbstractSampler
      implements ThreadListener, Interruptible

  A sampler which understands Tcp requests.
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `CLASSNAME`
    `static java.lang.String` | `CLOSE_CONNECTION`
    `static boolean` | `CLOSE_CONNECTION_DEFAULT`
    `static java.lang.String` | `EOL_BYTE`
    `static java.lang.String` | `FILENAME`
    `static java.lang.String` | `NODELAY`
    `static java.lang.String` | `PORT`
    `static java.lang.String` | `RE_USE_CONNECTION`
    `static boolean` | `RE_USE_CONNECTION_DEFAULT`
    `static java.lang.String` | `REQUEST`
    `static java.lang.String` | `SERVER`
    `static java.lang.String` | `SO_LINGER`
    `static java.lang.String` | `TIMEOUT`
    `static java.lang.String` | `TIMEOUT_CONNECT`

    - ### Fields inherited from interface org.apache.jmeter.testelement.TestElement

      `COMMENTS, ENABLED, GUI_CLASS, NAME, TEST_CLASS`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TCPSampler()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `applies(ConfigTestElement configElement)` Does configElement apply to Sampler
    `java.lang.String` | `getClassname()`
    `int` | `getConnectTimeout()`
    `int` | `getEolByte()`
    `java.lang.String` | `getFilename()`
    `java.lang.String` | `getLabel()` Returns a formatted string label describing this sampler Example output: Tcp://Tcp.nowhere.com/pub/README.txt
    `boolean` | `getNoDelay()`
    `java.lang.String` | `getPassword()`
    `int` | `getPort()`
    `java.lang.String` | `getRequestData()`
    `java.lang.String` | `getServer()`
    `int` | `getSoLinger()`
    `int` | `getTimeout()`
    `java.lang.String` | `getUsername()`
    `boolean` | `interrupt()` Interrupt the current operation if possible.
    `boolean` | `isCloseConnection()`
    `boolean` | `isReUseConnection()`
    `SampleResult` | `sample(Entry e)` Obtains statistics about the given Entry, and packages the information into a SampleResult.
    `void` | `setClassname(java.lang.String classname)`
    `void` | `setCloseConnection(java.lang.String close)`
    `void` | `setConnectTimeout(java.lang.String newTimeout)`
    `void` | `setEolByte(java.lang.String eol)`
    `void` | `setFilename(java.lang.String newFilename)`
    `void` | `setPort(java.lang.String newFilename)`
    `void` | `setRequestData(java.lang.String newRequestData)`
    `void` | `setServer(java.lang.String newServer)`
    `void` | `setSoLinger(java.lang.String soLinger)`
    `void` | `setTimeout(java.lang.String newTimeout)`
    `void` | `threadFinished()` Called for each thread after all samples have been processed.
    `void` | `threadStarted()` Called for each thread before starting sampling.

    - ### Methods inherited from class org.apache.jmeter.testelement.AbstractTestElement

      `addPropertiesValues, addProperty, addProperty, addTestElement, canRemove, clear, clearTemporary, clearTestElementChildren, clone, emptyTemporary, equals, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsInt, getPropertyAsLong, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getSearchableTokens, getThreadContext, getThreadName, hashCode, isEnabled, isRunningVersion, isTemporary, logProperties, mergeIn, propertyIterator, recoverRunningVersion, removeProperty, setComment, setEnabled, setName, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse, traverseCollection, traverseMap, traverseProperty`

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

      `finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.apache.jmeter.testelement.TestElement

      `addTestElement, canRemove, clear, clearTestElementChildren, clone, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsInt, getPropertyAsLong, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getThreadContext, getThreadName, isEnabled, isRunningVersion, isTemporary, propertyIterator, recoverRunningVersion, removed, removeProperty, setComment, setEnabled, setName, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse`

- - ### Field Detail

    - #### SERVER

          public static final java.lang.String SERVER

      See Also:
        Constant Field Values

    - #### PORT

          public static final java.lang.String PORT

      See Also:
        Constant Field Values

    - #### FILENAME

          public static final java.lang.String FILENAME

      See Also:
        Constant Field Values

    - #### CLASSNAME

          public static final java.lang.String CLASSNAME

      See Also:
        Constant Field Values

    - #### NODELAY

          public static final java.lang.String NODELAY

      See Also:
        Constant Field Values

    - #### TIMEOUT

          public static final java.lang.String TIMEOUT

      See Also:
        Constant Field Values

    - #### TIMEOUT_CONNECT

          public static final java.lang.String TIMEOUT_CONNECT

      See Also:
        Constant Field Values

    - #### REQUEST

          public static final java.lang.String REQUEST

      See Also:
        Constant Field Values

    - #### RE_USE_CONNECTION

          public static final java.lang.String RE_USE_CONNECTION

      See Also:
        Constant Field Values

    - #### RE_USE_CONNECTION_DEFAULT

          public static final boolean RE_USE_CONNECTION_DEFAULT

      See Also:
        Constant Field Values

    - #### CLOSE_CONNECTION

          public static final java.lang.String CLOSE_CONNECTION

      See Also:
        Constant Field Values

    - #### CLOSE_CONNECTION_DEFAULT

          public static final boolean CLOSE_CONNECTION_DEFAULT

      See Also:
        Constant Field Values

    - #### SO_LINGER

          public static final java.lang.String SO_LINGER

      See Also:
        Constant Field Values

    - #### EOL_BYTE

          public static final java.lang.String EOL_BYTE

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### TCPSampler

          public TCPSampler()

  - ### Method Detail

    - #### getUsername

          public java.lang.String getUsername()

    - #### getPassword

          public java.lang.String getPassword()

    - #### setServer

          public void setServer(java.lang.String newServer)

    - #### getServer

          public java.lang.String getServer()

    - #### isReUseConnection

          public boolean isReUseConnection()

    - #### setCloseConnection

          public void setCloseConnection(java.lang.String close)

    - #### isCloseConnection

          public boolean isCloseConnection()

    - #### setSoLinger

          public void setSoLinger(java.lang.String soLinger)

    - #### getSoLinger

          public int getSoLinger()

    - #### setEolByte

          public void setEolByte(java.lang.String eol)

    - #### getEolByte

          public int getEolByte()

    - #### setPort

          public void setPort(java.lang.String newFilename)

    - #### getPort

          public int getPort()

    - #### setFilename

          public void setFilename(java.lang.String newFilename)

    - #### getFilename

          public java.lang.String getFilename()

    - #### setRequestData

          public void setRequestData(java.lang.String newRequestData)

    - #### getRequestData

          public java.lang.String getRequestData()

    - #### setTimeout

          public void setTimeout(java.lang.String newTimeout)

    - #### getTimeout

          public int getTimeout()

    - #### setConnectTimeout

          public void setConnectTimeout(java.lang.String newTimeout)

    - #### getConnectTimeout

          public int getConnectTimeout()

    - #### getNoDelay

          public boolean getNoDelay()

    - #### setClassname

          public void setClassname(java.lang.String classname)

    - #### getClassname

          public java.lang.String getClassname()

    - #### getLabel

          public java.lang.String getLabel()

      Returns a formatted string label describing this sampler Example output: Tcp://Tcp.nowhere.com/pub/README.txt
      Returns:
        a formatted string label describing this sampler

    - #### sample

          public SampleResult sample(Entry e)

      Description copied from interface: `Sampler`
      Obtains statistics about the given Entry, and packages the information into a SampleResult.
      Specified by:
        `sample` in interface `Sampler`
      Parameters:
        `e` - the Entry (TODO seems to be unused)
      Returns:
        information about the sample

    - #### threadStarted

          public void threadStarted()

      Description copied from interface: `ThreadListener`
      Called for each thread before starting sampling. WARNING: this is called before any Config test elements are processed, so any properties they define will not have been merged in yet. See org.apache.jmeter.threads.JMeterThread#threadStarted()
      Specified by:
        `threadStarted` in interface `ThreadListener`

    - #### threadFinished

          public void threadFinished()

      Called for each thread after all samples have been processed. See org.apache.jmeter.threads.JMeterThread#threadFinished(org.apache.jmeter.engine.event.LoopIterationListener)
      Specified by:
        `threadFinished` in interface `ThreadListener`

    - #### applies

          public boolean applies(ConfigTestElement configElement)

      Description copied from class: `AbstractSampler`
      Does configElement apply to Sampler
      Specified by:
        `applies` in interface `ConfigMergabilityIndicator`
      Overrides:
        `applies` in class `AbstractSampler`
      Parameters:
        `configElement` - `ConfigTestElement`
      Returns:
        boolean
      See Also:
        `AbstractSampler.applies(org.apache.jmeter.config.ConfigTestElement)`

    - #### interrupt

          public boolean interrupt()

      Description copied from interface: `Interruptible`
      Interrupt the current operation if possible.
      Specified by:
        `interrupt` in interface `Interruptible`
      Returns:
        `true` if there was an operation to interrupt.

Copyright © 1998-2018 Apache Software Foundation. All Rights Reserved.