RPC Server Support
lgo_RpcAttachProtocol()
Attach to a communication service on a particular server.
#include "laygo.h"
LCid lgo_RpcAttachProtocol
(
LServerId serverId,
LProtocol protocol,
LMajorId major,
LMinorId minor
);
| serverId | server to attach on |
| protocol | protocol of service to attach to |
| major | major device id |
| minor | minor device id |
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.
If successful, lgo_RpcAttachProtocol() returns the connection id. Otherwise, it returns a negative value indicating the reason it failed. Possible unsuccessful return values are:
lgo_Attach()
lgo_AttachProtocol()
lgo_Close()
lgo_Open()
lgo_ReOpen()
lgo_RpcAttach()
lgo_RpcOpen()
lgo_RpcOpenProtocol()
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);
}