RPC Server Support

RPC Attach

lgo_RpcAttach()

Attach to a communication service on a particular server.

Syntax
#include "laygo.h"

LCid    lgo_RpcAttach
    (
        LServerId    serverId,
        LService     service
    );
serverIdserver to attach on
serviceservice to attach to
Description

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

lgo_RpcAttach() returns a CID exactly as lgo_RpcOpen() 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_RpcAttach() 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_RpcAttachProtocol()
lgo_RpcOpen()
lgo_RpcOpenProtocol()

Example
LServerId    serverId;

if ((serverId = lgo_RpcConnectServer(0)) >= 0)
{
    LCid  cid = lgo_RpcAttach(serverId, "PHYS0");

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

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

        lgo_Detach(cid);

        lgo_RpcDisconnectServer(serverId);

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