WebRTC Network
0.96
|
LocalNetwork. Simulate the IBasicNetwork locally in a single applicaiton. More...
Public Member Functions | |
void | StartServer (string serverAddress=null) |
Starts a server + asking for it to have a certain address. The use of the address is not guaranteed. If the address is in use the underlaying system will return ServerConnectionFailed. (This can also be triggered if anything else fails in the process) More... | |
void | StopServer () |
Stops incoming connections. This usually doesn't close existing connections thus can be used to enforce a certain amount of maximum allowed connections. More... | |
ConnectionId | Connect (string address) |
Connects to a given address or room name. More... | |
void | Shutdown () |
Disconnects all connection and shuts down the server if started. Dequeue will still return the confirmation messages such as Disconnected event for each connection. More... | |
void | SendData (ConnectionId userId, byte[] data, int offset, int length, bool reliable) |
Sends the content if a byte array to the given connection. More... | |
void | Update () |
Call this every frame if you intend to read incoming messages using Dequeue. This will make sure all data is read received by the network. More... | |
bool | Dequeue (out NetworkEvent evt) |
This will return the incoming network events. Call this method and handle the incoming events until it returns false. More... | |
bool | Peek (out NetworkEvent evt) |
Will return the first event in the queue without removing it. More... | |
void | Flush () |
Sends buffered data. More... | |
void | Disconnect (ConnectionId id) |
Disconnects the given connection More... | |
void | Dispose () |
Protected Member Functions | |
virtual void | Dispose (bool disposing) |
Properties | |
IList< ConnectionId > | Connections [get] |
bool | IsServer [get] |
LocalNetwork. Simulate the IBasicNetwork locally in a single applicaiton.
ConnectionId Byn.Net.LocalNetwork.Connect | ( | string | address | ) |
Connects to a given address or room name.
This call will result in one of those 2 events in response:
address | A string that identifies the target. |
Implements Byn.Net.IBasicNetwork.
bool Byn.Net.LocalNetwork.Dequeue | ( | out NetworkEvent | evt | ) |
This will return the incoming network events. Call this method and handle the incoming events until it returns false.
evt |
Implements Byn.Net.INetwork.
void Byn.Net.LocalNetwork.Disconnect | ( | ConnectionId | id | ) |
Disconnects the given connection
id | Id of the connection to disconnect. |
Implements Byn.Net.INetwork.
void Byn.Net.LocalNetwork.Flush | ( | ) |
Sends buffered data.
Implements Byn.Net.INetwork.
bool Byn.Net.LocalNetwork.Peek | ( | out NetworkEvent | evt | ) |
Will return the first event in the queue without removing it.
evt |
Implements Byn.Net.INetwork.
void Byn.Net.LocalNetwork.SendData | ( | ConnectionId | id, |
byte[] | data, | ||
int | offset, | ||
int | length, | ||
bool | reliable | ||
) |
Sends the content if a byte array to the given connection.
id | The id of the recipient |
data | Byte array containing the data to send |
offset | The index in data where the network should start to send |
length | Length in bytes you want to send |
reliable | True to send a reliable message(TCP style) and false to send unreliable (UDP style) |
Implements Byn.Net.INetwork.
void Byn.Net.LocalNetwork.Shutdown | ( | ) |
Disconnects all connection and shuts down the server if started. Dequeue will still return the confirmation messages such as Disconnected event for each connection.
Implements Byn.Net.INetwork.
void Byn.Net.LocalNetwork.StartServer | ( | string | address = null | ) |
Starts a server + asking for it to have a certain address. The use of the address is not guaranteed. If the address is in use the underlaying system will return ServerConnectionFailed. (This can also be triggered if anything else fails in the process)
address |
Implements Byn.Net.IBasicNetwork.
void Byn.Net.LocalNetwork.StopServer | ( | ) |
Stops incoming connections. This usually doesn't close existing connections thus can be used to enforce a certain amount of maximum allowed connections.
Implements Byn.Net.IBasicNetwork.
void Byn.Net.LocalNetwork.Update | ( | ) |
Call this every frame if you intend to read incoming messages using Dequeue. This will make sure all data is read received by the network.
Implements Byn.Net.INetwork.