closeAsynch

closeAsynch(receiver: Object;
            msg:      String);

The closeAsynch method of the TcpIpConnection class closes a connection to a remote application and returns immediately. When the connection is closed, the object specified in the receiver parameter is sent the name of the callback method specified in the msg parameter.

The closeAsynch method can be called when the connection is in any state.

On asynchronous calls, the state may not change immediately, and it may remain Connected (2) for a short period until JADE has rescheduled the request.

When the closeAsynch method completes, the user-written callback method specified in the msg parameter is called. The callback method must match the signature required by the calling closeAsynch method, as follows.

closeCallback(tcp: TcpIpConnection);

The following example shows the use of the closeAsynch method to set the variable conlog to reference a ConnectionLog object, create the object, and initialize its properties if no such object exists.

closeAsynch_click(btn: Button input) updating;
vars
    conlog : ConnectionLog;
begin
    // Closes the current connection and returns immediately.  When
    // the connection is closed, the ConnectionLog object referenced
    // by conlog is called and told to run the method updateCloseCalls.
    self.tcp.closeAsynch(conlog, "updateCloseCalls");
    statusLine1.caption := "Disconnected";
    textBox2.text := "";
    textBox3.text := "";
    textBox4.text := "";
end;