## org.apache.cassandra.thrift
Class TCustomSocket

    java.lang.Object
      org.apache.thrift.transport.TTransport
          org.apache.thrift.transport.TIOStreamTransport
              org.apache.cassandra.thrift.TCustomSocket

    public class TCustomSocket

extends org.apache.thrift.transport.TIOStreamTransport

Socket implementation of the TTransport interface. Adds socket buffering

Field Summary

Fields inherited from class org.apache.thrift.transport.TIOStreamTransport
`inputStream_, outputStream_`

Constructor Summary
`TCustomSocket(java.net.Socket socket)` Constructor that takes an already created socket.
`TCustomSocket(java.lang.String host, int port)` Creates a new unconnected socket that will connect to the given host on the given port.
`TCustomSocket(java.lang.String host, int port, int timeout)` Creates a new unconnected socket that will connect to the given host on the given port.

Method Summary
`void` `close()` Closes the socket.
`java.net.Socket` `getSocket()` Returns a reference to the underlying socket.
`boolean` `isOpen()` Checks whether the socket is connected.
`void` `open()` Connects the socket, creating a new socket object if necessary.
`void` `setTimeout(int timeout)` Sets the socket timeout

Methods inherited from class org.apache.thrift.transport.TIOStreamTransport
`flush, read, write`

Methods inherited from class org.apache.thrift.transport.TTransport
`consumeBuffer, getBuffer, getBufferPosition, getBytesRemainingInBuffer, peek, readAll, write`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### TCustomSocket

    public TCustomSocket(java.net.Socket socket)
                  throws org.apache.thrift.transport.TTransportException

  Constructor that takes an already created socket.

  Parameters:
    `socket` - Already created socket object
  Throws:
    `org.apache.thrift.transport.TTransportException` - if there is an error setting up the streams

### TCustomSocket

    public TCustomSocket(java.lang.String host,
                         int port)

  Creates a new unconnected socket that will connect to the given host on the given port.

  Parameters:
    `host` - Remote host
    `port` - Remote port

### TCustomSocket

    public TCustomSocket(java.lang.String host,
                         int port,
                         int timeout)

  Creates a new unconnected socket that will connect to the given host on the given port.

  Parameters:
    `host` - Remote host
    `port` - Remote port
    `timeout` - Socket timeout

Method Detail

### setTimeout

    public void setTimeout(int timeout)

  Sets the socket timeout

  Parameters:
    `timeout` - Milliseconds timeout

### getSocket

    public java.net.Socket getSocket()

  Returns a reference to the underlying socket.

### isOpen

    public boolean isOpen()

  Checks whether the socket is connected.

  Overrides:
    `isOpen` in class `org.apache.thrift.transport.TIOStreamTransport`

### open

    public void open()
              throws org.apache.thrift.transport.TTransportException

  Connects the socket, creating a new socket object if necessary.

  Overrides:
    `open` in class `org.apache.thrift.transport.TIOStreamTransport`
  Throws:
    `org.apache.thrift.transport.TTransportException`

### close

    public void close()

  Closes the socket.

  Overrides:
    `close` in class `org.apache.thrift.transport.TIOStreamTransport`

Copyright © 2012 The Apache Software Foundation