public class TCustomSocket
extends org.apache.thrift.transport.TIOStreamTransport
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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
|
public TCustomSocket(java.net.Socket socket) throws org.apache.thrift.transport.TTransportException
socket
- Already created socket objectorg.apache.thrift.transport.TTransportException
- if there is an error setting up the streamspublic TCustomSocket(java.lang.String host, int port)
host
- Remote hostport
- Remote portpublic TCustomSocket(java.lang.String host, int port, int timeout)
host
- Remote hostport
- Remote porttimeout
- Socket timeoutpublic void setTimeout(int timeout)
timeout
- Milliseconds timeoutpublic java.net.Socket getSocket()
public boolean isOpen()
isOpen
in class org.apache.thrift.transport.TIOStreamTransport
public void open() throws org.apache.thrift.transport.TTransportException
open
in class org.apache.thrift.transport.TIOStreamTransport
org.apache.thrift.transport.TTransportException
public void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class org.apache.thrift.transport.TIOStreamTransport
Copyright © 2015 The Apache Software Foundation