public class OCSClient extends Object
Constructor and Description |
---|
OCSClient() |
Modifier and Type | Method and Description |
---|---|
void |
connect(String host,
int port)
Connects to the specified Host and Port.
|
void |
disconnect()
Closes the current connection.
|
static Charset |
getEncoding()
Returns the
Charset used by the OCSClient. |
boolean |
isClosed()
Returns true iff the OCS socket is currently closed.
|
String |
sendMessage(String message)
Send a message through the OCS socket using the default timeout as
specified in the Alpaca properties file.
|
String |
sendMessage(String message,
int timeout)
Send a message through the OCS socket specifying the timeout.
|
public static Charset getEncoding()
Charset
used by the OCSClient.public void connect(String host, int port) throws IOException
host
- The host to connectport
- The port on the host to connectIOException
- Thrown if a fatal IO error occurspublic void disconnect() throws IOException
IOException
- Thrown if an issue occurs during disconnection.public boolean isClosed()
public String sendMessage(String message) throws Exception
message
- The message to send through the socket.Exception
- Thrown if there is a failure sending the packet.public String sendMessage(String message, int timeout) throws IOException, InterruptedException
message
- The message to send.timeout
- The message response timeout in milliseconds.IOException
- Thrown if there is a socket error.InterruptedException
- Thrown if there is a synchronization issue.Copyright © 2016 ECG. All rights reserved.