Drag[en]gine Script Module DragonScript  1.21
Dragengine.Networking.Connection Class Reference

Connection. More...

Inheritance diagram for Dragengine.Networking.Connection:

Public Member Functions

Constructors
Connection new ()
 Create connection. More...
 
Management
String getLocalAddress ()
 Llocal address. More...
 
String getRemoteAddress ()
 Remote address. More...
 
bool getConnected ()
 Connection is established. More...
 
bool connectTo (String address)
 Connect to host at address. More...
 
void disconnect ()
 Disconnect if connected. More...
 
void sendMessage (NetworkMessage message, int maxDelay)
 Send message if connected. More...
 
void sendReliableMessage (NetworkMessage message)
 Send reliable message if connected. More...
 
void linkState (NetworkMessage message, NetworkState state, bool readOnly)
 Link network state to remote network state. More...
 
ConnectionListener getConnectionListener ()
 Connection listener or null if not set. More...
 
void setConnectionListener (ConnectionListener listener)
 Set connection listener or null if not set. More...
 

Detailed Description

Connection.

This is a native class.

Member Function Documentation

◆ connectTo()

bool Dragengine.Networking.Connection.connectTo ( String  address)

Connect to host at address.

Connection success or failure is reported through the scripting peer. For the supported address format see Server.listenOn() .

Returns
true if the connection request has been send or false in case of error.

◆ disconnect()

void Dragengine.Networking.Connection.disconnect ( )

Disconnect if connected.

◆ getConnected()

bool Dragengine.Networking.Connection.getConnected ( )

Connection is established.

◆ getConnectionListener()

ConnectionListener Dragengine.Networking.Connection.getConnectionListener ( )

Connection listener or null if not set.

◆ getLocalAddress()

String Dragengine.Networking.Connection.getLocalAddress ( )

Llocal address.

◆ getRemoteAddress()

String Dragengine.Networking.Connection.getRemoteAddress ( )

Remote address.

◆ linkState()

void Dragengine.Networking.Connection.linkState ( NetworkMessage  message,
NetworkState  state,
bool  readOnly 
)

Link network state to remote network state.

Request is queued and carried out as soon as possible. The local state is considered the server state and the remote state the client state. The server state can always change values. The client state can only change values if allowed by the server state. Typically only the server sends out link request to clients. All these states are read only except those states belonging to the client which he has to be able to modify.

Parameters
messageContains information for the remote system to know what state to link to.
stateState to link with remote system.
readOnlyIf true remote state is not allowed to change.

◆ new()

Connection Dragengine.Networking.Connection.new ( )

Create connection.

◆ sendMessage()

void Dragengine.Networking.Connection.sendMessage ( NetworkMessage  message,
int  maxDelay 
)

Send message if connected.

The message can be queued and send at a later time to optimize throughput. The message will be not delayed longer than the given amount of milliseconds. The message is send unreliable and it is acceptable for the message to get lost due to transmission failure.

◆ sendReliableMessage()

void Dragengine.Networking.Connection.sendReliableMessage ( NetworkMessage  message)

Send reliable message if connected.

The message is append to already waiting reliable messages and send as soon as possible. Reliable messages always arrive in the same order they have been queued.

◆ setConnectionListener()

void Dragengine.Networking.Connection.setConnectionListener ( ConnectionListener  listener)

Set connection listener or null if not set.


The documentation for this class was generated from the following file: