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