public class DdeClient
extends java.lang.Object
| Constructor and Description |
|---|
DdeClient(java.lang.String service,
java.lang.String topic)
Creates a DDE client of the specified service and topic.
|
| Modifier and Type | Method and Description |
|---|---|
void |
abandonTransaction(long transactionID)
Abandons the specified asynchronous transaction and releases all transaction resources,
so that the event handler will not receive notification when the transaction is processed.
|
void |
connect()
Establishes connection with the service.
|
void |
disconnect()
Disconnects the client from the service.
|
void |
execute(java.lang.String command,
long timeout)
Executes the specified command and waits for a confirmation response
from the service.
|
long |
executeAsync(java.lang.String command)
Asynchronously executes the specified command.
|
byte[] |
get(DdeItem item,
long timeout)
Makes a synchronous request to the service for data
that corresponds to the specified item.
|
long |
getAsync(DdeItem item)
Makes an asynchronous request to the service for data
that corresponds to the specified item.
|
java.lang.String |
getServiceName()
Returns the service name which the client is connected to.
|
java.lang.String |
getTopicName()
Returns the topic name which the client is connected to.
|
void |
removeEventHandler()
Removes the handler of the client events.
|
void |
send(DdeItem item,
byte[] data,
long timeout)
Sends data to the service and waits for a confirmation response.
|
long |
sendAsync(DdeItem item,
byte[] data)
Asynchronously sends data to the service.
|
void |
setEventHandler(DdeClientEventHandler eventHandler)
Specifies the handler of the client events.
|
void |
startAdviseLoop(DdeItem item,
boolean sendData,
boolean sync,
long timeout)
Begins an advise loop and waits for confirmation response from the service.
|
long |
startAdviseLoopAsync(DdeItem item,
boolean sendData,
boolean sync)
Asynchronously begins an advise loop.
|
void |
stopAdviseLoop(DdeItem item,
long timeout)
Stops an advise loop and waits for a confirmation response from the service.
|
long |
stopAdviseLoopAsync(DdeItem item)
Asynchronously stops an advise loop.
|
public DdeClient(java.lang.String service,
java.lang.String topic)
service - is the name of the service of interest. It can be the basic name
(for example, MyService) or an instance-specific service name (for example, "MyService(0X0046025E)".topic - is the name of the service's topic.public void connect()
throws DdeException
DdeExceptionpublic void disconnect()
throws DdeException
DdeExceptionpublic long getAsync(DdeItem item) throws DdeException
item - specifies an item name and required data format.DdeExceptionDdeItempublic byte[] get(DdeItem item, long timeout) throws DdeException
item - specifies an item name and required data format.timeout - is the maximum amount of time, in milliseconds, that the client waits
for the server response.DdeExceptionpublic long sendAsync(DdeItem item, byte[] data) throws DdeException
item - specifies an item name and data format.data - is the data to be sent.DdeExceptionDdeItempublic void send(DdeItem item, byte[] data, long timeout) throws DdeException
item - specifies an item name and data format.data - is the data to be sent.timeout - is the maximum amount of time, in milliseconds, that the client waits
for the server's response.DdeExceptionDdeItempublic long executeAsync(java.lang.String command)
throws DdeException
command - specifies the command to be executed.DdeExceptionpublic void execute(java.lang.String command,
long timeout)
throws DdeException
command - specifies the command to be executed.timeout - is the maximum amount of time, in milliseconds, that the client waits
for the server's response.DdeExceptionpublic long startAdviseLoopAsync(DdeItem item, boolean sendData, boolean sync) throws DdeException
item - specifies an item name and required data format.sendData - if true, the service will send the changed data with notification,
otherwise, the service will notify the client without sending the data.sync - if true, the service will not send the next notification until
the previous one is processed by the client.DdeExceptionpublic void startAdviseLoop(DdeItem item, boolean sendData, boolean sync, long timeout) throws DdeException
item - specifies an item name and required data format.sendData - if true, the service will send the changed data with notification,
otherwise, the service will notify the client without sending the data.sync - if true, the service will not send the next notification until
the previous one is processed by the client.timeout - is the maximum amount of time, in milliseconds, that the client waits
for the server's response.DdeExceptionpublic long stopAdviseLoopAsync(DdeItem item) throws DdeException
item - specifies an item name.DdeExceptionpublic void stopAdviseLoop(DdeItem item, long timeout) throws DdeException
item - specifies an item name.timeout - is the maximum amount of time, in milliseconds, that the client waits
for the server's response.DdeExceptionpublic void abandonTransaction(long transactionID)
throws DdeException
transactionID - is a transaction identifier.DdeExceptionpublic java.lang.String getServiceName()
public java.lang.String getTopicName()
public void setEventHandler(DdeClientEventHandler eventHandler)
eventHandler - DdeClientEventHandlerpublic void removeEventHandler()