Vp connect universe: Difference between revisions

From Virtual Paradise Wiki
Jump to navigation Jump to search
Roy Curtis (talk | contribs)
m method templates
m updated syntax highlighting tags
Line 1: Line 1:
{{sdk method page|connect_universe|Connects an instance to a [[universe]] server. Required before an instance log in with user credentials and connects to any world.
{{Sdk method page|connect_universe|Connects an instance to a [[universe]] server. Required before an instance log in with user credentials and connects to any world.
|paramex="universe.virtualparadise.org", 57000
|paramex="universe.virtualparadise.org", 57000
|parameters=
|parameters=
Line 9: Line 9:
|caveats=To disconnect from a universe, {{sdk method|destroy}} must be called.
|caveats=To disconnect from a universe, {{sdk method|destroy}} must be called.
|examples=
|examples=
<C>
<syntaxhighlight lang="c">
int rc;
int rc;
if(rc = vp_connect_universe(instance, "universe.virtualparadise.org", 57000))
if(rc = vp_connect_universe(instance, "universe.virtualparadise.org", 57000))
     printf("Error connecting to universe (reason %d)\n", rc);
     printf("Error connecting to universe (reason %d)\n", rc);
</C>
</syntaxhighlight>
|seealso=
|seealso=
* {{sdk method|destroy}}
* {{sdk method|destroy}}
* {{sdk method|login}}
* {{sdk method|login}}
}}
}}

Revision as of 18:00, 6 February 2015

Method call snippet vp_connect_universe(instance, "universe.virtualparadise.org", 57000);

Connects an instance to a universe server. Required before an instance log in with user credentials and connects to any world.

Parameters

These are the parameters that this method requires:

Parameter Usage
VPInstance
instance
Pointer to the instance this method call is intended for
string
host
Hostname of uniserver; typically "universe.virtualparadise.org"
int
port
Port of uniserver; typically 57000

Returns

This method returns a return code integer, which indicates whether the call was successful or errored for any reason:

Return code Cause
VP_RC_SUCCESS Successful call (for methods that have a registered callback, it only means the request has been sent)
VP_RC_NOT_INITIALIZED SDK not initialized with vp_init() yet
VP_RC_CONNECTION_ERROR Error connecting to the universe server

Behavior

There is no special behavior for this method

Caveats

To disconnect from a universe, vp_destroy() must be called.

Examples

int rc;
if(rc = vp_connect_universe(instance, "universe.virtualparadise.org", 57000))
    printf("Error connecting to universe (reason %d)\n", rc);

See also