Click here to Skip to main content
15,746,652 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, i need some help to figure out how to implement a kind of datastructure where, for now, three input/output sources a able to interchange data. For example A writes to B, C reads from B and C writes to A and so on. Currently my approach is doing a lot of switch/case or if/else that not really handy. Like to have something more elegant.

What I have tried:

nothing special and spreed around multiple c/h files
Updated 1-May-23 14:17pm

Best is to implement some common data structure like a struct which has zero when no data, or use some data file like jason or xml.
tip: always handle
or the
in a switch to avoid unhandled cases.
Share this answer
You write that the data comes from multiple iOS devices that should be able to send as well as receive.
Unfortunately, some important details are missing. You didn't describe how the devices find each other, or if it's a fixed set of known devices at startup. of known devices. Is there a maximum length for the messages? Should the exchange be blocking or asynchronous? Should they be sent and received simultaneously?

Before you solve something like this yourself with threads and synchronization, or install a web server on each computer, you could check if it can be solved e.g. with MPI.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900