public class TSocket extends TIOStreamTransport
inputStream_, outputStream_
Constructor | Description |
---|---|
TSocket(java.lang.String host,
int port) |
Creates a new unconnected socket that will connect to the given host
on the given port.
|
TSocket(java.lang.String host,
int port,
int timeout) |
Creates a new unconnected socket that will connect to the given host
on the given port.
|
TSocket(java.net.Socket socket) |
Constructor that takes an already created socket.
|
Modifier and Type | Method | 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
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
flush, read, write
consumeBuffer, getBuffer, getBufferPosition, getBytesRemainingInBuffer, peek, readAll, write
public TSocket(java.net.Socket socket) throws TTransportException
socket
- Already created socket objectTTransportException
- if there is an error setting up the streamspublic TSocket(java.lang.String host, int port)
host
- Remote hostport
- Remote portpublic TSocket(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 TIOStreamTransport
public void open() throws TTransportException
open
in class TIOStreamTransport
TTransportException
- if the transport could not be openedpublic void close()
close
in class TIOStreamTransport