/Utilities/Networking/BasicMessageTypes.cs
# · C# · 44 lines · 9 code · 2 blank · 33 comment · 0 complexity · dde090ca5b2efdac4fd43760c7582ba9 MD5 · raw file
- namespace Delta.Utilities.Networking
- {
- /// <summary>
- /// Basic message types. Used for unit tests and even for the LogServer.
- /// Please note that you need to implement this in the ClientData class
- /// that is being used by the BaseServer and Client you are using. It could
- /// be easier to create types dynamically like for BaseControl in Scenes,
- /// but performance is very important for network messages and this types
- /// are extremely compact (just 1 byte) and very fast and still easy enough
- /// to use and extend for all kinds of networking code.
- /// </summary>
- public enum BasicMessageTypes : byte
- {
- /// <summary>
- /// Connect message from the client to the server once we connected. This
- /// does not contain any data by default, but if you enable cryptography
- /// this contains the random seed value for all decryption (can be resent
- /// by the server from time to time). For really secure transmissions you
- /// can optionally also use RSA cryptography by sending the AES seed value
- /// encrypted with a public RSA key that only the server can decrypt.
- /// Derived classes can also provide extra functionality if needed.
- /// Some servers like the log server just need a username, nothing else.
- /// </summary>
- Connect = 0,
-
- /// <summary>
- /// After the server has received the Connect message from the client, it
- /// should respond with the Login message telling the client if the login
- /// succeeded and any other data required for the login. This is the first
- /// message send from the server to the client and if the server rejects
- /// it, we are usually disconnected right away again (user not found,
- /// password wrong, decryption failed).
- /// </summary>
- Login = 1,
-
- /// <summary>
- /// Text message by the connected user, will be displayed together with the
- /// current time in this format: Time: Username: Message. Only used by
- /// simple services like the log server, usually overwritten with some
- /// other message types for more advanced servers.
- /// </summary>
- TextMessage = 2,
- }
- }