RPC Server Support

RPC Attach Protocol

lgo_RpcAttachProtocol()

Attach to a communication service on a particular server.

Syntax
#include "laygo.h"

LCid    lgo_RpcAttachProtocol
    (
        LServerId    serverId,
        LProtocol    protocol,
        LMajorId     major,
        LMinorId     minor
    );
serverIdserver to attach on
protocolprotocol of service to attach to
majormajor device id
minorminor device id
Description

lgo_RpcAttachProtocol() attaches to a service on a particular server which was previously opened with lgo_RpcOpenProtocol() and detached with lgo_Detach().

lgo_RpcAttachProtocol() returns a CID exactly as lgo_RpcOpenProtocol() 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_RpcAttachProtocol() returns the connection id. Otherwise, it returns a negative value indicating the reason it failed. Possible unsuccessful return values are:

See Also

lgo_Attach()
lgo_AttachProtocol()
lgo_Close()
lgo_Open()
lgo_ReOpen()
lgo_RpcAttach()
lgo_RpcOpen()
lgo_RpcOpenProtocol()

Example
LServerId    serverId;

if ((serverId = lgo_RpcConnectServer(0)) >= 0)
{
    LCid  cid = lgo_RpcAttachProtocol(serverId, lgo_PROTOCOL_X21_BIS, 0, 0);

    if (cid < 0)
    {
        lgo_RpcDisconnectServer(serverId);

        return (FAILURE);
    }
    else
    {
        CheckStatus(cid);

        lgo_Detach(cid);

        lgo_RpcDisconnectServer(serverId);

        return (SUCCESS);
    }
}
else
{
    return (FAILURE);
}