architecture - C# UDP Communication-Stack implementation advise -
i writing c# program , struggling bit conceptional question.
a domain of application communication microcontroller via udp. therefore using udpclient , wrote 'communicator' encoding/decoding, checksum checks, etc.
i need have kind of controller allows me send commands udp-server (the device). of them single pair of send/receive, others long-running.
i thought following implemenation: 
my idea every capability of microcontroller/udp-server abstracted in class, has 'execute'-function subscribes 'receive' of underlying communicator , sends request.
however, bit stuck here: wait in 'execute ' function of each task(capability) event trigger in onreceive-handler (or timeout). not work if 1 task needs multiple send/receive.
so, there design-pattern that? or have advise on how implement in proper way?
you can have communicator , commandexecuter , share queue between them. communicator puts every command receives udp , goes it's duty receive new commands. commandexecuter watching queue. long there new command in queue, takes , executes it.
Comments
Post a Comment