@@ -9,19 +9,38 @@ namespace Adrenak.AirPeer {
99 /// An AirPeer Node. Can serve as a server and a client.
1010 /// </summary>
1111 public class APNode {
12+ /// <summary>
13+ /// Describes the different modes that an <see cref="APNode"/> can be on
14+ /// </summary>
1215 public enum Mode {
16+ /// <summary>
17+ /// State when the node is neither a server (i.e. hosting a network with or
18+ /// without clients) or a client (connected to a server and part of a network).
19+ /// </summary>
1320 Idle ,
21+
22+ /// <summary>
23+ /// State when the node is hosting a network at an address. May or may not
24+ /// have clients.
25+ /// </summary>
1426 Server ,
27+
28+ /// <summary>
29+ /// State when the node is connected to a server node and part of a network.
30+ /// </summary>
1531 Client
1632 }
1733
1834 /// <summary>
19- /// the current mode of the node
35+ /// The current mode of the node. The <see cref="Mode"/> changes to <see cref="Mode.Idle"/>
36+ /// in error scenarios too such as when the node fails to become a server, fails to connect
37+ /// to a server. Or when the server is stopped or the client is disconnected.
2038 /// </summary>
2139 public Mode CurrentMode { get ; private set ; }
2240
2341 /// <summary>
24- /// The name of the server the node is hosting/connected to
42+ /// The address of the network the node is i) hosting as a server or ii) connected to
43+ /// a as a client
2544 /// </summary>
2645 public string Address { get ; private set ; }
2746
@@ -31,23 +50,23 @@ public enum Mode {
3150 public short ID { get ; private set ; } = - 1 ;
3251
3352 /// <summary>
34- /// The IDs of the peers of this node
53+ /// The IDs of other nodes on this network (not including own ID)
3554 /// </summary>
36- public List < short > Peers = new List < short > ( ) ;
55+ public List < short > Peers { get ; private set ; } = new List < short > ( ) ;
3756
3857 // Common
3958 /// <summary>
40- /// Fired when another client joins the network
59+ /// Fired when a new client joins the network
4160 /// </summary>
4261 public event Action < short > OnClientJoined ;
4362
4463 /// <summary>
45- /// Fired when another client leaves the network
64+ /// Fired when a client leaves the network
4665 /// </summary>
4766 public event Action < short > OnClientLeft ;
4867
4968 /// <summary>
50- /// Fired when the node is assigned an ID
69+ /// Fired when this node is assigned an ID
5170 /// </summary>
5271 public event Action < short > OnReceiveID ;
5372
@@ -98,10 +117,9 @@ public enum Mode {
98117 ConnectionId serverCID = ConnectionId . INVALID ;
99118
100119 /// <summary>
101- /// Constructs a peer with the given the signalling server and with a default list of ICE servers
120+ /// Constructs a <see cref="APNode"/> with the given the signaling server URL and with a default list of ICE servers.
102121 /// </summary>
103122 /// <param name="signalingServer">The URL of the signalling server</param>
104- /// <param name="iceServer">List of URLs of ICE servers</param>
105123 public APNode ( string signalingServer ) : this ( signalingServer , new [ ] {
106124 "stun.l.google.com:19302" ,
107125 "stun1.l.google.com:19302" ,
@@ -113,7 +131,7 @@ public APNode(string signalingServer) : this(signalingServer, new[] {
113131 } ) { }
114132
115133 /// <summary>
116- /// Constructs a peer with the given the signalling server and a list of ICE servers
134+ /// Constructs a node with the given the signaling server and a list of ICE servers
117135 /// </summary>
118136 /// <param name="signalingServer">The URL of the signalling server</param>
119137 /// <param name="iceServer">List of URLs of ICE servers</param>
@@ -136,7 +154,7 @@ public APNode(string signalingServer, string[] iceServer) {
136154 // API
137155 // ================================================
138156 /// <summary>
139- /// Starts the server with a name
157+ /// Starts the server using the given address.
140158 /// </summary>
141159 public void StartServer ( string address ) {
142160 if ( CurrentMode == Mode . Idle ) {
@@ -172,36 +190,36 @@ public void Disconnect() {
172190 }
173191
174192 /// <summary>
175- /// Sends a packet message to a single recipient
193+ /// Sends a packet message to a recipient peer
176194 /// </summary>
177- /// <param name="recipient">Recipient ID</param>
195+ /// <param name="recipient">Recipient peer ID</param>
178196 /// <param name="packet">The packet containing the message</param>
179197 /// <param name="reliable">Whether the message is reliable or not</param>
180198 public void SendPacket ( short recipient , Packet packet , bool reliable = false ) =>
181199 SendPacket ( new List < short > { recipient } , packet , reliable ) ;
182200
183201 /// <summary>
184- /// Sends a packet message to several recipients
202+ /// Sends a packet message to several recipient peers
185203 /// </summary>
186- /// <param name="recipients">Recipient IDs</param>
204+ /// <param name="recipients">Recipient peer IDs</param>
187205 /// <param name="packet">The packet containing the message</param>
188206 /// <param name="reliable">Whether the message is reliable or not</param>
189207 public void SendPacket ( List < short > recipients , Packet packet , bool reliable = false ) =>
190208 SendRaw ( recipients , packet . Serialize ( ) , reliable ) ;
191209
192210 /// <summary>
193- /// Sends a byte array to a single recipient
211+ /// Sends a byte array to a single recipient peer
194212 /// </summary>
195- /// <param name="recipient">The recipient ID</param>
213+ /// <param name="recipient">The recipient peer ID</param>
196214 /// <param name="bytes">The byte array to send</param>
197215 /// <param name="reliable">Whether the message is reliable or not</param>
198216 public void SendRaw ( short recipient , byte [ ] bytes , bool reliable = false ) =>
199217 SendRaw ( new List < short > { recipient } , bytes , reliable ) ;
200218
201219 /// <summary>
202- /// Sends a byte array to several recipients
220+ /// Sends a byte array to several recipient peers
203221 /// </summary>
204- /// <param name="recipients">A list of the recipient IDs</param>
222+ /// <param name="recipients">A list of the recipient peer IDs</param>
205223 /// <param name="bytes">The byte array to send</param>
206224 /// <param name="reliable">Whether the message is reliable or not</param>
207225 public void SendRaw ( List < short > recipients , byte [ ] bytes , bool reliable = false ) {
0 commit comments