lgo_RpcConnectServerIp()
Establish a connection to the LayGO RPC Server based on the server's IP address.
#include "laygo.h" LServerId lgo_RpcConnectServerIp ( LServerAddress ipAddress );
ipAddress | IP address of server to connect to |
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.
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:
lgo_ConnectServer()
lgo_ConnectServerIp()
lgo_ConnectServerLocal()
lgo_DisconnectServer()
lgo_ShutdownServer()
lgo_RpcConnectServer()
lgo_RpcConnectServerLocal()
lgo_RpcDisconnectServer()
lgo_RpcShutdownServer()
LServerAddress serverAddress = "102.33.122.241"; if (lgo_RpcConnectServerIp(serverAddress) < 0) { printf("Cannot connect to server at %s.\n", serverAddress); exit(EXIT_FAILURE); }