PageRenderTime 191ms CodeModel.GetById 121ms app.highlight 10ms RepoModel.GetById 50ms app.codeStats 1ms

/Dlls/Delta.Utilities.Networking.xml

#
XML | 1045 lines | 1045 code | 0 blank | 0 comment | 0 complexity | 7a24e8cd8d5228577d559f7b17f6136e MD5 | raw file

Large files files are truncated, but you can click here to view the full file

  1<?xml version="1.0"?>
  2<doc>
  3    <assembly>
  4        <name>Delta.Utilities.Networking</name>
  5    </assembly>
  6    <members>
  7        <member name="T:Delta.Utilities.Networking.BaseServer">
  8            <summary>
  9            Tcp Server base class. Provides useful functionality for server programs
 10            like the Log server or the Content and Build Server. Basically listens
 11            for clients with a TcpListener and manages a list of Sockets for
 12            connected clients. Build on top of the SocketHelper and StreamHelper
 13            functionality of the Delta.Utilities.Helpers assembly. Also provides
 14            compression functionality automatically for all messages with a payload
 15            of over 1024 bytes (like files). Additionally all network traffic can
 16            be encrypted with AES cryptography and the initial seed value can even
 17            be decrypted with a secret RSA key using a public RSA key on the clients.
 18            <para />
 19            Please keep in mind that a server usually has many clients that can
 20            connect and send data. All client methods like OnClientLogin and
 21            OnMessageReceived can be called from different data receiving threads
 22            and should be made thread safe (put a lock around critical code blocks).
 23            </summary>
 24        </member>
 25        <member name="F:Delta.Utilities.Networking.BaseServer.privateKey">
 26            <summary>
 27            Private key for encryption, see Cryptography class for details, by
 28            default this is null and unused. Please note that for encryption the
 29            first message send from the client to the server must be the Connect
 30            message (message type 0) and it contains the random seed (optionally
 31            even encrypted with a public RSA key from the server). See the
 32            <see cref="!:HandleConnectDecryption"/> method for details.
 33            <para/>
 34            Note: The AES decryption instance can be found in each client.
 35            Most importantly the Client must also have the same privateKey, which
 36            should be kept secret (but even if it is known by an attacker, if you
 37            encrypted the random seed with RSA, the transmission is still secure).
 38            </summary>
 39        </member>
 40        <member name="F:Delta.Utilities.Networking.BaseServer.rsa">
 41            <summary>
 42            You can even use an secret RSA key to decrypt incoming client requests
 43            (that must have been signed with the matching public RSA key). If this
 44            variable is null, no RSA cryptography is used.
 45            </summary>
 46        </member>
 47        <member name="F:Delta.Utilities.Networking.BaseServer.numOfMessageTypes">
 48            <summary>
 49            Number of message types this server supports. Derived classes set this
 50            in the constructor and handle each message type in OnMessageReceived.
 51            </summary>
 52        </member>
 53        <member name="F:Delta.Utilities.Networking.BaseServer.clients">
 54            <summary>
 55            List of client sockets current connected, will be enumerated in the
 56            HandleClients method, which handles all the connection, disconnection
 57            and receiving data logic.
 58            </summary>
 59        </member>
 60        <member name="F:Delta.Utilities.Networking.BaseServer.shutdownServer">
 61            <summary>
 62            Set this variable to true to shutdown all threads and pending
 63            operations on this server. Done in the Close method.
 64            </summary>
 65        </member>
 66        <member name="F:Delta.Utilities.Networking.BaseServer.listenerThreads">
 67            <summary>
 68            Helper threads for running the TcpServer in a different thread (because
 69            it is blocking in ListenForClients). This starts the data receiving
 70            as well (which works completely asynchrony so we don't need an extra
 71            thread for that). Multiple threads are used for each listener port.
 72            </summary>
 73        </member>
 74        <member name="F:Delta.Utilities.Networking.BaseServer.clientDisconnectThread">
 75            <summary>
 76            Because tcpServerThread just listens for clients and adds new ones
 77            into the clients list, we need this extra thread to remove disconnected
 78            clients again when the underlying socket is not longer connected.
 79            </summary>
 80        </member>
 81        <member name="M:Delta.Utilities.Networking.BaseServer.#ctor(System.String[],System.Int32[],System.Byte,System.Byte[],Delta.Utilities.Xml.XmlNode)">
 82            <summary>
 83            Create TCP server, which will immediately start to listen on the
 84            specified TCP port. Listening actually happens in a separate thread
 85            and handling all the clients and receiving their messages happens in
 86            another thread (because the listening thread blocks). This constructor
 87            will return right away and you can continue with your code. Use the
 88            delegates to be notified when clients connect or disconnect or new
 89            data arrives. Note: All messages are automatically compressed if they
 90            have above 1024 bytes of payload (see Delta.Utilities.Compression.Zip).
 91            <para/>
 92            Encryption is also optionally possible and can be enabled by using a
 93            private key (null by default, which means unused) and you can even
 94            use an secret RSA key to decrypt incoming client requests (that must
 95            have been signed with the matching public RSA key).
 96            </summary>
 97            <param name="setIPAddressesToListenOn">Optional list of IP addresses
 98            to listen on (one for each port). Can be null for IPAddress.Any</param>
 99            <param name="setListenerPorts">Lists of ports to listen on for
100            incoming clients.</param>
101            <param name="setNumberOfMessageTypes">
102            Set number of message types to be used in all network communications
103            with clients (any incoming data with a message type value above this
104            is not allowed and will be rejected).
105            </param>
106            <param name="setPrivateKey">
107            Private key for encryption, see Cryptography class for details, by
108            default this is null and unused. Please note that for encryption the
109            first message send from the client to the server must be the Connect
110            message (message type 0) and it contains the random seed (optionally
111            even encrypted with a public RSA key from the server).
112            Most importantly the ClientData must also have the same privateKey,
113            which should be kept secret (but even if it is known by an attacked
114            if you encrypted the random seed with RSA, the transmission is still
115            secure).
116            </param>
117            <param name="secretRsaKey">Secret RSA key on the server (2048 bits)
118            that is used to decrypt incoming Connect messages from clients, which
119            encrypt their seed value in the Connect message with the matching
120            public RSA key that only the server can decrypt. Note: To generate
121            a secret and public RSA key pair use the CryptographyTests.
122            </param>
123            <exception cref="T:System.ArgumentNullException">
124            Thrown if no ports are specified. The BaseServer needs at least one
125            port to listen to!
126            </exception>
127            <exception cref="T:System.Exception">
128            Thrown if we failed to initialize the TcpListener on given ports.
129            </exception>
130        </member>
131        <member name="M:Delta.Utilities.Networking.BaseServer.#ctor(System.Int32,System.Byte,System.Byte[],Delta.Utilities.Xml.XmlNode)">
132            <summary>
133            Create TCP server, which will immediately start to listen on the
134            specified TCP port. Listening actually happens in a separate thread
135            and handling all the clients and receiving their messages happens in
136            another thread (because the listening thread blocks). This constructor
137            will return right away and you can continue with your code. Use the
138            delegates to be notified when clients connect or disconnect or new
139            data arrives. Note: All messages are automatically compressed if they
140            have above 1024 bytes of payload (see Delta.Utilities.Compression.Zip).
141            <para />
142            Encryption is also optionally possible and can be enabled by using a
143            private key (null by default, which means unused) and you can even
144            use an secret RSA key to decrypt incoming client requests (that must
145            have been signed with the matching public RSA key).
146            </summary>
147            <param name="setListenerPort">
148            Port to listen on for incoming clients.
149            </param>
150            <param name="setNumberOfMessageTypes">
151            Set number of message types to be used in all network communications
152            with clients (any incoming data with a message type value above this
153            is not allowed and will be rejected).
154            </param>
155            <param name="setPrivateKey">
156            Private key for encryption, see Cryptography class for details, by
157            default this is null and unused. Please note that for encryption the
158            first message send from the client to the server must be the Connect
159            message (message type 0) and it contains the random seed (optionally
160            even encrypted with a public RSA key from the server).
161            Most importantly the ClientData must also have the same privateKey,
162            which should be kept secret (but even if it is known by an attacked
163            if you encrypted the random seed with RSA, the transmission is still
164            secure).
165            </param>
166            <param name="secretRsaKey">Secret RSA key on the server (2048 bits)
167            that is used to decrypt incoming Connect messages from clients, which
168            encrypt their seed value in the Connect message with the matching
169            public RSA key that only the server can decrypt. Note: To generate
170            a secret and public RSA key pair use the CryptographyTests.
171            </param>
172        </member>
173        <member name="M:Delta.Utilities.Networking.BaseServer.Finalize">
174            <summary>
175            ~Base server
176            </summary>
177        </member>
178        <member name="M:Delta.Utilities.Networking.BaseServer.Dispose">
179            <summary>
180            Stop tcp server, should be called at the end of the application.
181            </summary>
182        </member>
183        <member name="M:Delta.Utilities.Networking.BaseServer.SendTextToAllClients(System.String)">
184            <summary>
185            Send text message with the predefined TextMessage type.
186            </summary>
187            <param name="textMessage">Text Message</param>
188        </member>
189        <member name="M:Delta.Utilities.Networking.BaseServer.CreateClient(System.Net.Sockets.Socket)">
190            <summary>
191            Create client data helper method to allow creating derived client data
192            classes in derived BaseServer classes.
193            </summary>
194            <param name="clientSocket">Client Socket</param>
195            <returns>
196            Client instance for keeping the socket and all client data around as
197            long as the server needs this.
198            </returns>
199        </member>
200        <member name="M:Delta.Utilities.Networking.BaseServer.ListenForClients(System.Object)">
201            <summary>
202            Listen for clients. Note: This method will block in an extra thread
203            while waiting for client connections and run forever in an endless
204            listening mode. To abort kill the whole thread, which will be catched
205            here and the listener will be killed in the finally block.
206            </summary>
207        </member>
208        <member name="M:Delta.Utilities.Networking.BaseServer.HandleClientDisconnects">
209            <summary>
210            Handle client disconnects, loops through all clients and checks if
211            they are still connected. Currently just handles disconnects, but
212            reconnects could be made possible and Peer-To-Peer logic would be
213            more complex, but for now this does not much.
214            </summary>
215        </member>
216        <member name="M:Delta.Utilities.Networking.BaseServer.HandleClientLogin(Delta.Utilities.Networking.BaseClient,System.IO.BinaryReader)">
217            <summary>
218            Handle client login
219            </summary>
220            <param name="client">Client</param>
221            <param name="data">Data</param>
222        </member>
223        <member name="M:Delta.Utilities.Networking.BaseServer.OnClientLogin(Delta.Utilities.Networking.BaseClient,System.IO.BinaryReader)">
224            <summary>
225            Event that is fired every time a new client connects and has send the
226            Login message (after the Connect message), see
227            <see cref="!:Client.OnRawMessageReceived"/> for details.
228            <para/>
229            This gives us a chance to handle the Login request here and reject
230            clients if anything is wrong (wrong password, ip is banned, etc.).
231            Return false if you want to reject the client, you can also send out
232            a Login message to the client first with the reason for rejecting him.
233            If this method returns true you also must send out a Login message to
234            notify the client that he is now connected and logged in.
235            </summary>
236            <param name="client">Client that send the Login message</param>
237            <param name="data">Data the client send for this Login message
238            (already decrypted and uncompressed). This is by default just
239            the username, but you can send whatever login information you need.
240            </param>
241            <returns>True if the client is successfully logged in or false if we
242            had to reject this client (see Login message for reject reasons).
243            </returns>
244        </member>
245        <member name="M:Delta.Utilities.Networking.BaseServer.OnClientDisconnected(Delta.Utilities.Networking.BaseClient)">
246            <summary>
247            Event that is fired every time a client disconnects to inform the
248            server about the not longer connected client. This can happen on
249            purpose by either side or because the connection was disconnected.
250            <para />
251            Note: Does just call client.Dispose, if you need more server side logic
252            implement it in derived classes.
253            </summary>
254            <param name="client">Client that has been connected. Please note that
255            this could even happen before OnClientConnected is even called (but
256            this is very unlikely, then the Connect message must be messed up).
257            </param>
258        </member>
259        <member name="M:Delta.Utilities.Networking.BaseServer.HandleMessageReceived(Delta.Utilities.Networking.BaseClient,System.Byte,System.IO.BinaryReader)">
260            <summary>
261            Handle message received
262            </summary>
263            <param name="client">Client</param>
264            <param name="messageType">Message type</param>
265            <param name="data">Data</param>
266        </member>
267        <member name="M:Delta.Utilities.Networking.BaseServer.OnMessageReceived(Delta.Utilities.Networking.BaseClient,System.Byte,System.IO.BinaryReader)">
268            <summary>
269            Event that is fired every time a full message is received, called by
270            <see cref="M:Delta.Utilities.Networking.BaseClient.OnRawMessageReceived(System.Byte,System.IO.BinaryReader,System.Boolean)"/>. Note: This is not the
271            same as receiving raw network data as a new data package might not
272            contain a full message yet, or even contain multiple message for that
273            matter. Additionally decompression and decryption is already handled.
274            <para/>
275            Each message consists of a message type (byte) and the data (bytes).
276            Note: OnPreCheckMessage is not supported by default in
277            BaseServer, but you can easily add it if needed (for checking big
278            messages) or just use the Client.OnPreCheckMessage method.
279            </summary>
280            <param name="client">Client we are receiving data for</param>
281            <param name="messageType">Message type we received</param>
282            <param name="data">Data we have received for this message type
283            (already uncompressed and decrypted)</param>
284        </member>
285        <member name="T:Delta.Utilities.Networking.BasicMessageTypes">
286            <summary>
287            Basic message types. Used for unit tests and even for the LogServer.
288            Please note that you need to implement this in the ClientData class
289            that is being used by the BaseServer and Client you are using. It could
290            be easier to create types dynamically like for BaseControl in Scenes,
291            but performance is very important for network messages and this types
292            are extremely compact (just 1 byte) and very fast and still easy enough
293            to use and extend for all kinds of networking code.
294            </summary>
295        </member>
296        <member name="F:Delta.Utilities.Networking.BasicMessageTypes.Connect">
297            <summary>
298            Connect message from the client to the server once we connected. This
299            does not contain any data by default, but if you enable cryptography
300            this contains the random seed value for all decryption (can be resent
301            by the server from time to time). For really secure transmissions you
302            can optionally also use RSA cryptography by sending the AES seed value
303            encrypted with a public RSA key that only the server can decrypt.
304            Derived classes can also provide extra functionality if needed.
305            Some servers like the log server just need a username, nothing else.
306            </summary>
307        </member>
308        <member name="F:Delta.Utilities.Networking.BasicMessageTypes.Login">
309            <summary>
310            After the server has received the Connect message from the client, it
311            should respond with the Login message telling the client if the login
312            succeeded and any other data required for the login. This is the first
313            message send from the server to the client and if the server rejects
314            it, we are usually disconnected right away again (user not found,
315            password wrong, decryption failed).
316            </summary>
317        </member>
318        <member name="F:Delta.Utilities.Networking.BasicMessageTypes.TextMessage">
319            <summary>
320            Text message by the connected user, will be displayed together with the
321            current time in this format: Time: Username: Message. Only used by
322            simple services like the log server, usually overwritten with some
323            other message types for more advanced servers.
324            </summary>
325        </member>
326        <member name="T:Delta.Utilities.Networking.BaseClient">
327            <summary>
328            Base class for connected clients. Contains most importantly the
329            connected socket, but also some extra information like the username.
330            Used both on the BaseServer side (then we just care about the socket
331            and the basic data and networking functionality) and in the Client
332            that connects to the BaseServer (then all features are used). Derive
333            from this to add more functionality. If you just want to use this
334            class the MessageReceived is the easiest way to receive network data.
335            <para />
336            This class also support encryption with AES and RSA to make network
337            transmissions really secure. See the constructors for details.
338            <para />
339            Internally also used as a receiving data helper class by defining
340            buffers for receiving data. Thanks to the IAsyncState passed around in
341            StartReceivingMessages this data will be preserved as long as the client
342            is connected. RememberLastData is important for partial message we might
343            receive (if incoming data is bigger than receivedData can hold or if we
344            get multiple messages at once or strange packet sizes, which is very
345            normal for TCP packets).
346            </summary>
347        </member>
348        <member name="F:Delta.Utilities.Networking.BaseClient.DefaultConnectionTimeoutMs">
349            <summary>
350            Default time to wait until we timeout a connection attempt. Since this
351            runs in an extra thread we do not actually have to wait this long.
352            The default wait time is 3 seconds, which should be enough for most
353            users (even if a timeout happens, the user can try again).
354            </summary>
355        </member>
356        <member name="F:Delta.Utilities.Networking.BaseClient.WaitTimeTillNextConnectionAttemptMs">
357            <summary>
358            Wait time in ms until we try to connect again if the connection failed.
359            We wait for 1 seconds (3 in release mode) and then try again.
360            More is too annoying when developing and this happens (because we
361            might just started the server or just fixed our connection problems).
362            </summary>
363        </member>
364        <member name="F:Delta.Utilities.Networking.BaseClient.NumberOfBasicMessageTypes">
365            <summary>
366            Number of basic message types (add this if you are planing to use
367            the BasicMessageTypes plus own types in derived classes).
368            </summary>
369        </member>
370        <member name="F:Delta.Utilities.Networking.BaseClient.Username">
371            <summary>
372            Username for this client. We mostly only care on the server what the
373            name of each connected client is (for identification and debugging).
374            This is set after receiving the Connect message from the client in
375            the OnConnected method and used quite a bit on servers and clients.
376            More complex clients with username, passwords, emails, etc. obviously
377            have more data and you don't have to use this at all (just override
378            the Login methods).
379            </summary>
380        </member>
381        <member name="F:Delta.Utilities.Networking.BaseClient.OnDisconnected">
382            <summary>
383            Delegate to be notified when we lose the connection to the server.
384            Note: This is only called when the server disconnects us (or we lose
385            the network connection somehow), this is not called when we dispose
386            the BaseClient via the Dispose method (which you can override if you
387            want to handle normal disposes).
388            </summary>
389        </member>
390        <member name="F:Delta.Utilities.Networking.BaseClient.connected">
391            <summary>
392            Helper flag to remember if we have successfully connected (for server
393            side client connections). Initially this is false and only after
394            receiving the Connect (on the server) message with success we are
395            fully connected (or once we established the connection on the client
396            side). When not connected any attempt to receive any other message will
397            result in failure and the client will immediately disconnect in the
398            <see cref="M:Delta.Utilities.Networking.BaseClient.OnRawMessageReceived(System.Byte,System.IO.BinaryReader,System.Boolean)"/> method.
399            </summary>
400        </member>
401        <member name="F:Delta.Utilities.Networking.BaseClient.loggedIn">
402            <summary>
403            Is the client logged in? Initially false and will be set to true if
404            the Login message has been received and is successful (both on the
405            client and the server side). Any attempt to receive or send messages
406            to a non connected and not loggedIn client will immediately result in 
407            a failure and the client will be disconnected.
408            </summary>
409        </member>
410        <member name="F:Delta.Utilities.Networking.BaseClient.maxNumOfMessageTypes">
411            <summary>
412            Maximum number of message types, set in constructor. Only used to
413            provide checks if incoming data is valid and can be converted into
414            a known message type with data.
415            </summary>
416        </member>
417        <member name="F:Delta.Utilities.Networking.BaseClient.clientBufferData">
418            <summary>
419            Client buffer data, internal to allow SocketHelper access to this
420            and protected to allow derived classes to override the
421            StartReceivingMessagesAndSendConnectMessage method.
422            </summary>
423        </member>
424        <member name="F:Delta.Utilities.Networking.BaseClient.rememberLastData">
425            <summary>
426            Remember last data, also only used for the SocketHelper class.
427            </summary>
428        </member>
429        <member name="F:Delta.Utilities.Networking.BaseClient.connectionThread">
430            <summary>
431            Helper thread to make connection initialization go as smoothly as
432            possible. Note: This is only used on the client side (server already
433            has a connected socket when creating a new Client instance).
434            If we are still connecting sending out messages is delayed. If the
435            connection is already established, we can send out messages directly
436            (which is easier and quicker and this thread is not longer needed).
437            </summary>
438        </member>
439        <member name="F:Delta.Utilities.Networking.BaseClient.aes">
440            <summary>
441            Remember AES cryptography if this is wanted for the client server
442            communication. Both the client and the server instance must be
443            initialized with the same private AES key. The server has to wait
444            until the Connected message arrives from the client to setup the
445            Cryptography class with this same private key and seed value.
446            </summary>
447        </member>
448        <member name="F:Delta.Utilities.Networking.BaseClient.rsa">
449            <summary>
450            You can even use an public RSA key to encrypt Connect messages, which
451            can be decrypted the matching secret RSA key on the server. If this
452            variable is null, no RSA cryptography is used.
453            </summary>
454        </member>
455        <member name="F:Delta.Utilities.Networking.BaseClient.linkToServer">
456            <summary>
457            Link to the BaseServer if this is a connected client on the server.
458            Needed to check if cryptography data is valid and to decrypt it.
459            </summary>
460        </member>
461        <member name="F:Delta.Utilities.Networking.BaseClient.remToSendMessageType">
462            <summary>
463            Helper list to send out messages in case we are not connected yet!
464            </summary>
465        </member>
466        <member name="F:Delta.Utilities.Networking.BaseClient.remToSendMessageData">
467            <summary>
468            Helper list for the data of messages to be send out.
469            </summary>
470        </member>
471        <member name="F:Delta.Utilities.Networking.BaseClient.remToSendMessageCompression">
472            <summary>
473            Helper list for the data of messages to be send out if compression
474            should be enabled or not (default is true).
475            </summary>
476        </member>
477        <member name="M:Delta.Utilities.Networking.BaseClient.#ctor(System.Net.Sockets.Socket,System.Byte,Delta.Utilities.Networking.BaseServer)">
478            <summary>
479            Create client instance with an already known connected socket. Only
480            used on the server side for client connections. The client side has to
481            use the other constructor to get connected to the server.
482            This constructor will cause the ClientSide property to return false.
483            </summary>
484            <param name="setMaxNumOfMessageTypes">Set max number of message types,
485            which is the same value as the server uses.</param>
486            <param name="setClientSocket">Get client socket</param>
487            <param name="setLinkToServer">
488            Link to the BaseServer if this is a connected client on the server.
489            Needed to check if cryptography data is valid and to decrypt.
490            </param>
491        </member>
492        <member name="M:Delta.Utilities.Networking.BaseClient.#ctor(System.String,System.Int32[],System.Byte,System.Boolean,System.String,System.Byte[],Delta.Utilities.Xml.XmlNode)">
493            <summary>
494            Create a new tcp client and connect to a remote BaseServer instance.
495            </summary>
496            <param name="setServerAddress">Set server address</param>
497            <param name="setServerPorts">
498            List of server ports we can use to connect, they will be tried in this
499            order (useful in case some ports are blocked, e.g. in company networks).
500            </param>
501            <param name="setMaxMessageTypes">Set max number of message types,
502            which is the same value as the server uses.</param>
503            <param name="keepTryingToConnectEndlessly">Keep trying to connect
504            endlessly, which should only be used when you also call Dispose
505            (e.g. from Application.Close or when closing the window). If this is
506            done without calling Dispose and no server connect is possible, the
507            connectionThread is never quit and you need to kill the process.
508            </param>
509            <param name="setUsername">Username for the Login method,
510            can be overwritten, but this is the default value for it.</param>
511            <param name="privateKey">
512            Private key for encryption, see Cryptography class for details, by
513            default this is null and unused. Please note that for encryption the
514            first message send from the client to the server must be the Connect
515            message (message type 0) and it contains the random seed (optionally
516            even encrypted with a public RSA key from the server).
517            Most importantly the ClientData must also have the same privateKey,
518            which should be kept secret (but even if it is known by an attacked
519            if you encrypted the random seed with RSA, the transmission is still
520            secure).
521            </param>
522            <param name="publicRsaKey">
523            Public RSA key, which must match the secret RSA key on the server
524            (2048 bits) that is used to decrypt incoming Connect messages from
525            clients, which encrypt their seed value in the Connect message.
526            Note: This is ignored if privateKey is null (works only together).
527            </param>
528        </member>
529        <member name="M:Delta.Utilities.Networking.BaseClient.#ctor(System.String,System.Int32,System.Byte,System.Boolean,System.String,System.Byte[],Delta.Utilities.Xml.XmlNode)">
530            <summary>
531            Create a new tcp client and connect to a remote BaseServer instance.
532            </summary>
533            <param name="setServerAddress">Set server address</param>
534            <param name="setServerPort">Set server port</param>
535            <param name="setMaxNumOfMessageTypes">Set max number of message types,
536            which is the same value as the server uses.</param>
537            <param name="keepTryingToConnectEndlessly">Keep trying to connect
538            endlessly, which should only be used when you also call Dispose
539            (e.g. from Application.Close or when closing the window). If this is
540            done without calling Dispose and no server connect is possible, the
541            connectionThread is never quit and you need to kill the process.
542            </param>
543            <param name="setUsername">Username for the Login method,
544            can be overwritten, but this is the default value for it.</param>
545            <param name="setPrivateKey">
546            Private key for encryption, see Cryptography class for details, by
547            default this is null and unused. Please note that for encryption the
548            first message send from the client to the server must be the Connect
549            message (message type 0) and it contains the random seed (optionally
550            even encrypted with a public RSA key from the server).
551            Most importantly the ClientData must also have the same privateKey,
552            which should be kept secret (but even if it is known by an attacked
553            if you encrypted the random seed with RSA, the transmission is still
554            secure).
555            </param>
556            <param name="publicRsaKey">
557            Public RSA key, which must match the secret RSA key on the server
558            (2048 bits) that is used to decrypt incoming Connect messages from
559            clients, which encrypt their seed value in the Connect message.
560            Note: This is ignored if privateKey is null (works only together).
561            </param>
562        </member>
563        <member name="M:Delta.Utilities.Networking.BaseClient.ConnectSocketAndStartReceivingMessages(System.String,System.Int32[],System.Boolean)">
564            <summary>
565            Helper method to connect to the server in an extra thread.
566            </summary>
567            <param name="serverAddress">Server address to connect to</param>
568            <param name="serverPorts">Server port(s) to connect to</param>
569            <param name="keepTryingToConnectEndlessly">Keep trying to connect
570            endlessly, which should only be used when you also call Dispose
571            (e.g. from Application.Close or when closing the window). If this is
572            done without calling Dispose and no server connect is possible, the
573            connectionThread is never quit and you need to kill the process.
574            </param>
575        </member>
576        <member name="M:Delta.Utilities.Networking.BaseClient.Dispose">
577            <summary>
578            Dispose the client, will kill the threads and sockets. Also called if
579            the host disconnects us and in BaseServer.OnClientDisconnects.
580            </summary>
581        </member>
582        <member name="M:Delta.Utilities.Networking.BaseClient.Finalize">
583            <summary>
584            Destructor, will just call Dispose to kill the threads and sockets.
585            </summary>
586        </member>
587        <member name="M:Delta.Utilities.Networking.BaseClient.StartReceivingMessages">
588            <summary>
589            Start receiving messages, which will use the SocketHelper functionality
590            by default, but you can override this to get different behavior.
591            All you need for that is a message received delegate, which will be
592            called whenever a full message arrives to one of the clients. This
593            method is all you need after you have a connected socket (either when
594            you connected to a server or a server that listened for clients). By
595            default messageReceived is handled by the SocketHelper automatically.
596            Optionally you can also get notified whenever data arrives in case you
597            want to update progress bars for big data packages.
598            </summary>
599        </member>
600        <member name="M:Delta.Utilities.Networking.BaseClient.HandleConnectEncryption(System.IO.BinaryWriter)">
601            <summary>
602            Write encryption information for the Connect message, see the
603            ClientData.SendConnectMessage method for details. This message starts
604            with a helper byte to mark if we use encryption and then adds the
605            seed value (either as a plain byte array or encrypted with RSA).
606            </summary>
607            <param name="writer">Writer to store binary data to</param>
608        </member>
609        <member name="M:Delta.Utilities.Networking.BaseClient.SendConnectMessageToServer">
610            <summary>
611            Send out the Connect message from the client to the server with the
612            optional encryption seed value (which might even be RSA encrypted) for
613            secure network transmissions. This information must always be send via
614            the <see cref="M:Delta.Utilities.Networking.BaseClient.HandleConnectEncryption(System.IO.BinaryWriter)"/> method. Additional user
615            information (username, password, etc.) can also be send with help of
616            the Login message (see <see cref="M:Delta.Utilities.Networking.BaseClient.SendLoginMessageToServer"/>).
617            <para/>
618            Called by <see cref="M:Delta.Utilities.Networking.BaseClient.ConnectSocketAndStartReceivingMessages(System.String,System.Int32[],System.Boolean)"/>
619            </summary>
620        </member>
621        <member name="M:Delta.Utilities.Networking.BaseClient.SendLoginMessageToServer">
622            <summary>
623            Send out the Login message from the client to the server (after the
624            Connect message has been set and everything is setup). By default only
625            the username is sent, override this method for more functionality.
626            Note: There are two reasons why Connect and Login is separated. First
627            it makes deriving this method easier as we do not need to handle the
628            Connect and encryption logic here. And it also makes sending,
629            encrypting and receiving and decrypting the Login message easier and
630            more secure (all data in Login is already encrypted and cannot be
631            decrypted without a successful Connect message was processed first).
632            <para/>
633            Called by <see cref="M:Delta.Utilities.Networking.BaseClient.ConnectSocketAndStartReceivingMessages(System.String,System.Int32[],System.Boolean)"/>
634            </summary>
635        </member>
636        <member name="M:Delta.Utilities.Networking.BaseClient.OnLogin(System.IO.BinaryReader)">
637            <summary>
638            On login helper method, will be called once the connection has been
639            established and we got the Login message from the server. Does nothing
640            here, but derived classes can extend this functionality to receive the
641            login status, username and extra login information from the server.
642            </summary>
643            <param name="data">Data we received from the network</param>
644            <returns>True if we are still connected and are successfully logged in
645            or false otherwise if the server rejected us and we need to reconnect.
646            </returns>
647        </member>
648        <member name="M:Delta.Utilities.Networking.BaseClient.OnMessageReceived(System.Byte,System.IO.BinaryReader)">
649            <summary>
650            When a message arrived from the server and has been processed, this
651            method will be called from OnRawMessageReceived (if everything is ok).
652            Override for more functionality, this method will however not report
653            the Connect (0) and Login (1) BasicMessageTypes functionality and
654            encryption and decryption is done automatically in the caller for us.
655            <para />
656            Note: This is the only method here you must implement in derived
657            classes to make sense of client server communication. It is however
658            not used if this is a server side client connection (see first
659            constructor).
660            </summary>
661            <param name="messageType">Type of message received (byte)</param>
662            <param name="data">Data we received from the network (uncompressed
663            and un-encrypted, all handled by OnRawMessageReceived)</param>
664        </member>
665        <member name="M:Delta.Utilities.Networking.BaseClient.HandleConnectDecryption(System.IO.BinaryReader)">
666            <summary>
667            Helper method to decrypt incoming Connect messages from clients in
668            case they are encrypted (done on the server side). Will only work if
669            both the client and the server use the same AES cryptography private
670            keys and if used matching  secret and public RSA keys for the AES seed
671            value. If no cryptography is used just a byte with the value 0 is read
672            from the data stream and the OnConnected method will handle all the
673            rest (Username, etc.)
674            <para/>
675            This method will disconnect the client right away if anything is wrong
676            like different encryption modes on the server or client.
677            Note: Called only from <see cref="M:Delta.Utilities.Networking.BaseClient.OnRawMessageReceived(System.Byte,System.IO.BinaryReader,System.Boolean)"/> for servers.
678            </summary>
679            <param name="data">Data we received from the network</param>
680            <returns>True if we could connect successfully, false otherwise
681            (invalid connection attempt, encryption data invalid, etc.)</returns>
682        </member>
683        <member name="M:Delta.Utilities.Networking.BaseClient.OnRawMessageReceived(System.Byte,System.IO.BinaryReader,System.Boolean)">
684            <summary>
685            When a message arrived from the server this method will be called from
686            <see cref="M:Delta.Utilities.Networking.SocketHelper.ReceiveMessageData(Delta.Utilities.Networking.BaseClient,System.Int32)"/> with the raw message type
687            and data. The data can be compressed and encrypted, this method will
688            handle all the decryption and decompression automatically for us and
689            also handles all the Connect (0) and Login (1) functionality.
690            <para/>
691            Note: This method does all the heavy lifting including Connection and
692            Login logic plus decompression and decryption of network data. Read
693            it carefully if you want to understand how the underlying message
694            system works. See the Delta.Utilities.Tests for lots of examples.
695            </summary>
696            <param name="messageType">Type of message received (byte)</param>
697            <param name="data">Data we received from the network (can be
698            encrypted and compressed, see the Send methods for encryption)</param>
699            <param name="isCompressed">Is the incoming data compressed and need
700            to be decompressed?</param>
701        </member>
702        <member name="M:Delta.Utilities.Networking.BaseClient.HandlePreCheckMessage(System.Byte,System.Single)">
703            <summary>
704            Handle pre check message
705            </summary>
706            <param name="messageType">Message type</param>
707            <param name="percentageComplete">Percentage complete</param>
708        </member>
709        <member name="M:Delta.Utilities.Networking.BaseClient.OnPreCheckMessage(System.Byte,System.Single)">
710            <summary>
711            On pre check message is fired when a message is incoming, but not
712            complete yet (should only happen for big messages like file
713            transfers). This way we can update status bars and show percentages.
714            Not used by default, override to do something with this information.
715            <para/>
716            Please note that this message does not actually read or provide any
717            of the payload data, all we know is the message type and the
718            percentage of the message that already has been transmitted. None of
719            the decryption, decompression or data reading logic happens here
720            (unlike <see cref="M:Delta.Utilities.Networking.BaseClient.OnRawMessageReceived(System.Byte,System.IO.BinaryReader,System.Boolean)"/>). If you want to provide
721            additional meta data like a file size or how many MB have been
722            transfered, please just send an extra message before this big one to
723            show this information to the user (TotalMB * percentageComplete).
724            </summary>
725            <param name="messageType">Type of message we are currently receiving
726            (as a byte)</param>
727            <param name="percentageComplete">Percentage complete (0.0-1.0)</param>
728        </member>
729        <member name="M:Delta.Utilities.Networking.BaseClient.Send(System.Byte)">
730            <summary>
731            Send an empty message with just a message type to the server.
732            </summary>
733            <param name="messageType">Message Type</param>
734        </member>
735        <member name="M:Delta.Utilities.Networking.BaseClient.Send(System.Byte,System.IO.MemoryStream)">
736            <summary>
737            Send a message with a message type and some data in a MemoryStream
738            to the server.
739            </summary>
740            <param name="messageType">Message Type</param>
741            <param name="data">Data for this message</param>
742        </member>
743        <member name="M:Delta.Utilities.Networking.BaseClient.Send(System.Byte,System.String)">
744            <summary>
745            Send a message with a message type and a string as data to the server.
746            </summary>
747            <param name="messageType">Message Type</param>
748            <param name="data">Data as a string, will be converted to bytes</param>
749        </member>
750        <member name="M:Delta.Utilities.Networking.BaseClient.Send(System.Byte,System.Single)">
751            <summary>
752            Send a message with a message type and a float as data to the server.
753            </summary>
754            <param name="messageType">Message Type</param>
755            <param name="data">Data as float, will be converted to bytes</param>
756        </member>
757        <member name="M:Delta.Utilities.Networking.BaseClient.SendBytes(System.Byte,System.Byte[],System.Boolean)">
758            <summary>
759            Send the byte array to the server with the specified message type.
760            Note: Can be overwritten to catch all sends and do some extra logic
761            like collecting statistics.
762            </summary>
763            <param name="messageType">Type of message (as byte)</param>
764            <param name="data">Data</param>
765            <param name="allowToCompressMessage">Allow to automatically compress
766            the message payload data if it is above 1024 bytes (otherwise nothing
767            will happen), on by default. Please note an extra byte with 0xFF (255)
768            is sent to mark that the incoming message is compressed.</param>
769        </member>
770        <member name="M:Delta.Utilities.Networking.BaseClient.SendTextMessage(System.String)">
771            <summary>
772            Send text message with the predefined TextMessage type (type=2).
773            </summary>
774            <param name="textMessage">Text message</param>
775        </member>
776        <member name="M:Delta.Utilities.Networking.BaseClient.ToString">
777            <summary>
778            To string method to display some debug information about this client.
779            </summary>
780            <returns>String with detailed client and socket information</returns>
781        </member>
782        <member name="P:Delta.Utilities.Networking.BaseClient.Socket">
783            <summary>
784            Client socket if we are the server. If we are the client this is the
785            server connection socket we send all data to.
786            </summary>
787        </member>
788        <member name="P:Delta.Utilities.Networking.BaseClient.SuccessfullyLoggedIn">
789            <summary>
790            Helper method to check if we are successfully logged in. Please do not
791            use this one to check if we have received the login message because
792            this will not be true if the server rejected us and disconnects us.
793            Instead override the OnLogin method to see when we are connected or
794            when we might be disconnected before this ever gets true.
795            </summary>
796        </member>
797        <member name="P:Delta.Utilities.Networking.BaseClient.ServerAddress">
798            <summary>
799            Address to the server. Only set in constructor, cannot be changed.
800            Not used for BaseServer clients.
801            </summary>
802        </member>
803        <member name="P:Delta.Utilities.Networking.BaseClient.ServerPorts">
804            <summary>
805            List of server ports we can use to connect, they will be tried in this
806            order (useful in case some ports are blocked, e.g. in company networks).
807            Only set in constructor, cannot be changed. Not used for BaseServer
808            clients.
809            </summary>
810        </member>
811        <member name="P:Delta.Utilities.Networking.BaseClient.IsClientSide">
812            <summary>
813            Is the connection made on the client side or is this just the
814            connection from the server to the client (then this returns false).
815            </summary>
816        </member>
817        <member name="T:Delta.Utilities.Networking.BaseClient.DisconnectDelegate">
818            <summary>
819            Delegate for t…

Large files files are truncated, but you can click here to view the full file