WebRTC Network  0.96
Public Member Functions | List of all members
Byn.Net.IBasicNetwork Interface Reference

Used to represent a network interface that can allow incoming connections or connect to another network. More...

Inheritance diagram for Byn.Net.IBasicNetwork:
Byn.Net.INetwork Byn.Net.IWebRtcNetwork Byn.Net.LocalNetwork

Public Member Functions

void 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) 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...
 
- Public Member Functions inherited from Byn.Net.INetwork
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 SendData (ConnectionId id, byte[] data, int offset, int length, bool reliable)
 Sends the content if a byte array to the given connection. More...
 
void Disconnect (ConnectionId id)
 Disconnects the given connection 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 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...
 

Detailed Description

Used to represent a network interface that can allow incoming connections or connect to another network.

Address can be any kind of string. This could be a ip address and port, websockets or an key in a dictionary on a server to get the exact connection details from somewhere else.

Member Function Documentation

ConnectionId Byn.Net.IBasicNetwork.Connect ( string  address)

Connects to a given address or room name.

This call will result in one of those 2 events in response:

  • NewConnection if the connection was established
  • ConnectionFailed if the connection failed.
Parameters
addressA string that identifies the target.
Returns
Returns the Connection id the established connection will have (only supported by WebRtcNetwork).

Implemented in Byn.Net.LocalNetwork.

void Byn.Net.IBasicNetwork.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)

Parameters
address

Implemented in Byn.Net.LocalNetwork.

void Byn.Net.IBasicNetwork.StopServer ( )

Stops incoming connections. This usually doesn't close existing connections thus can be used to enforce a certain amount of maximum allowed connections.

Implemented in Byn.Net.LocalNetwork.


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