Managing Protocol Services

Detach

lgo_Detach()

Detach from an open communication service without closing.

Syntax
#include "laygo.h"

LResult lgo_Detach
    (
        LCid    cid
    );
cidconnection to detach from
Description

lgo_Detach() detaches from a previously opened connection. The connection need not be in the open state to detach from it, and typically is not. After lgo_Detach() returns successfully, lgo_State() called with the same CID will return lgo_STATE_CLOSED.

A service relinquished with lgo_Detach() can be reacquired using lgo_Attach(). Note that when the service is reacquired, it may have a different CID than before.

lgo_Detach() is normally used once a physical, link or packet major device has entered the data transfer state. Normal control messages are discarded while the connection is detached.

Return Values

If successful, lgo_Detach() returns a non-negative value. Otherwise, it returns a negative value indicating the reason it failed. Possible unsuccessful return values are:

See Also

lgo_Attach()

Example
if (lgo_State(cid) == lgo_STATE_DATA_TRANSFER_XON)
{
    lgo_Detach(cid);
}