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