NOTIFICATION
This is a pretty big question, so please bear with me, and I apologize in advance if this is unclear. To make this question manageable and to minimize confusion, I omit some properties from the copy and paste classes.
CONTEXT
I am writing a network application - an application such as "remote desktop", so that the average technician-developer can help his friends or neighbors with computer problems. I understand free and much more advanced software such as TeamViewer, but this question does not discuss the practicality of creating this software.
GENERAL TERMS AND CONDITIONS
The client is a technical developer, the assistant is the controller. A server is a "victim" who is in distress. Typically, a client typically runs commands on the server.
INFORMATION
This software is more than a live view / control app. I need additional modules, such as a file explorer module and a chat module (so that they can communicate without using additional instant messaging software).
Initially, my approach to sending and receiving messages via UDP was manual and inefficient. (I use the Lidgren library for UDP networks, so why my packets do not show low bytes, such as the size of the header message.)
Original Packet Structure:
Byte Index Type Purpose/Description
------------------------------------------------------
0 byte The intended destination module (e.g. 1 -> Chat module)
1 byte The command for this module to perform (e.g. 0 -> NewChatMessage)
2 byte Encryption/compression flag
3 byte Packet priority flag (e.g. Cancel packets should be processed first)
4-X ? Command-specific arguments of variable type (e.g. For this example, the argument would be the actual chat message text)
, 100 . , . " " "" (- ) . , if-else.
. , ( ), - . , .
Revised Packet Structure:
Byte Index Type Purpose/Description
------------------------------------------------------
0-X String Serialized class
. - . , /. , . :
public class Packet
{
public Module DestinationModule { get; set; }
public EncryptionCompressionFlag EncryptedOrCompressed { get; set; }
public PacketPriority Priority { get; set; }
}
( )
public class WelcomeModulePacket : Packet
{
public ModuleCommand Command { get; set; }
}
public enum ModuleCommand : byte
{
ClientRequestingConnectionPacket = 0,
}
WelcomeModulePacket:
, , "CommandModule", , . "ModuleCommand" .
public class ClientRequestingConnectionPacket : WelcomeModulePacket
{
public string Username { get; set; }
public string Password { get; set; }
}
, , , .
ClientRequestingConnectionPacket : WelcomeModulePacket : Packet
, , ClientRequestingConnectionPacket, . , enqueuing "ClientRequestingConnectionPacket" PriorityQueue ( , "Packet" "PacketPriority" ). , , ClientRequestingConnectionPacket. , , , , , - ClientRequestingConnectionPacket, , .
, , :
Type UltimateType { get; set; }
"". , "" , .
, StackOverflow, ? ? ? ?
: ?