lgo_RpcAttach()
Attach to a communication service on a particular server.
#include "laygo.h" LCid lgo_RpcAttach ( LServerId serverId, LService service );
serverId | server to attach on |
service | service to attach to |
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.
If successful, lgo_RpcAttach() 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_RpcAttachProtocol()
lgo_RpcOpen()
lgo_RpcOpenProtocol()
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); }