Managing Protocol Services

Attach Protocol

lgo_AttachProtocol()

Attach to a communication service.

Syntax
#include "laygo.h"

LCid    lgo_AttachProtocol
    (
        LProtocol    protocol,
        LMajorId     major,
        LMinorId     minor
    );
protocolid of protocol to attach to
majorid of major device
minorid of minor device
Description

lgo_AttachProtocol() attaches to a service which was previously opened with lgo_OpenProtocol() and detached with lgo_Detach().

lgo_AttachProtocol() returns a CID exactly as lgo_OpenProtocol() does. However, the connection may not be in the open state. lgo_State() can be used to determine what state the connection is in.

Return Values

If successful, lgo_AttachProtocol() returns a non-negative connection identifier (CID) which uniquely identifies the connection during subsequent transactions. Otherwise, it returns a negative value indicating the reason it failed. Possible unsuccessful return values are:

See Also

lgo_Attach()
lgo_OpenProtocol()

Example
LCid    cid;

if ((cid = lgo_AttachProtocol(lgo_PROTOCOL_X21_BIS, 0, 0) < 0)
{
    return (FAILURE);
}