RPC Server Support

RPC Connect Server IP

lgo_RpcConnectServerIp()

Establish a connection to the LayGO RPC Server based on the server's IP address.

Syntax
#include "laygo.h"

LServerId lgo_RpcConnectServerIp
    (
          LServerAddress    ipAddress
    );
ipAddressIP address of server to connect to
Description

lgo_RpcConnectServerIp() may be used in place of lgo_RpcConnectServer() to establish a connection to a LayGO RPC Server. lgo_RpcConnectServerIp() uses the server's IP address to locate the server, connecting with TCP/IP.

lgo_RpcConnectServerIp() must be the first API function called when using the RPC version of LayGO. If lgo_RpcConnectServerIp() fails, it is not safe to call any other API function. Failure to observe this restriction may result in an application exception.

Clients can connect to only one server at a time.

Return Values

If successful, lgo_RpcConnectServerIp() returns a non-negative value. Otherwise, it returns a negative value indicating the reason it failed. Possible unsuccessful return values are:

See Also

lgo_ConnectServer()
lgo_ConnectServerIp()
lgo_ConnectServerLocal()
lgo_DisconnectServer()
lgo_ShutdownServer()
lgo_RpcConnectServer()
lgo_RpcConnectServerLocal()
lgo_RpcDisconnectServer()
lgo_RpcShutdownServer()

Example
LServerAddress    serverAddress = "102.33.122.241";

if (lgo_RpcConnectServerIp(serverAddress) < 0)
{
    printf("Cannot connect to server at %s.\n", serverAddress);
    exit(EXIT_FAILURE);
}