Vp connect universe: Difference between revisions

From Virtual Paradise Wiki
Jump to navigation Jump to search
(new page)
Line 1: Line 1:
<C>int vp_connect_universe(VPInstance instance, char* host, int port)</C>
{{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
== Description ==
|parameters=
Connects to a universe server.
  {{sdk parameter row|string|host|Hostname of uniserver; typically {{code|"universe.virtualparadise.org"}}}}
 
  {{sdk parameter row|int  |port|Port of uniserver; typically {{code|57000}}}}
== Callback ==
|returncodes=
None
  {{sdk return code row|NOT_INITIALIZED|SDK not initialized with {{sdk method|init}} yet}}
 
  {{sdk return code row|CONNECTION_ERROR|Error connecting to the universe server}}
== Notes ==
|caveats=To disconnect from a universe, {{sdk method|destroy}} must be called.
None
|examples=
 
<C>
== Arguments ==
int rc;
;instance:The SDK instance with which to connect.
;host:Host address of the server to which the SDK should connect.
;port:TCP port of the remove server.
 
== Argument attributes ==
None
 
== Return values ==
;[[SDK_Reason_Codes#VP_RC_SUCCESS|VP_RC_SUCCESS]]
;[[SDK_Reason_Codes#VP_RC_NOT_INITIALIZED|VP_RC_NOT_INITIALIZED]]
;[[SDK_Reason_Codes#VP_RC_CONNECTION_ERROR|VP_RC_CONNECTION_ERROR]]:There was an error connecting to the server.
 
== Returned attributes ==
None
 
== Example ==
<C>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);</C>
     printf("Error connecting to universe (reason %d)\n", rc);
 
</C>
== See also ==
|seealso=
* [[vp_destroy]]
* [[vp_destroy]]
* [[vp_login]]
* [[vp_login]]
 
}}
[[Category: SDK]]

Revision as of 15:13, 29 September 2013

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

<C> int rc; if(rc = vp_connect_universe(instance, "universe.virtualparadise.org", 57000))

   printf("Error connecting to universe (reason %d)\n", rc);

</C>

See also