RPC Server Support

Connect Server IP

lgo_ConnectServerIp()

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

Syntax
#include "laygo.h"

LResult lgo_ConnectServerIp
    (
        LServerAddress    ipAddress
    );
ipAddressIP address of server to connect to
Description

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

lgo_ConnectServerIp() must be the first API function called when using the RPC version of LayGO. If lgo_ConnectServerIp() 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_ConnectServerIp() 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_ConnectServerLocal()
lgo_DisconnectServer()
lgo_ShutdownServer()
lgo_RpcConnectServer()
lgo_RpcConnectServerIp()
lgo_RpcConnectServerLocal()
lgo_RpcDisconnectServer()
lgo_RpcShutdownServer()

Example
LServerAddress    serverAddress = "102.33.122.241";

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