1

I have intermediate level of understanding on how TCP and serial works, I've also been able to develop system that uses

  1. 1 TCP client and 1 Serial
  2. 2 Serials
  3. 1 TCP Server
  4. 1 TCP client

My problem is that whenever I am creating a new project there are different needs, sometimes it's 1 TCP client and 1 Serial, sometimes it is 5 serials.

Right now I am thinking whether preparing 5 serial, 5 TCP client and 1 Server that can be enabled or disabled depending on my projects need is reliable? Preparing 5 seems too much, but I want to prepare it so whenever there is a need I can quickly activate them.

Some suggested that by using class I can do the same. I never use classes, I can study it but the question is do I really need it or is there a best way to do this?

-1

wrapping each connection in an instance (of a class) allows for easily caching partial messages, thus allowing a single-threaded model to handle all the communications tasks without blocking. (assuming you can figure out how to do non-bloking reads and writes) by being single threaded you avoid the synchronization problems that can plague multi-threaded code.

| improve this answer | |
  • Why the down-vote? – Jasen May 29 '16 at 9:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.