2

I want to be able to send messages between computers on the internet network but with minimal functionality

requirement are- 1)computers can join/leave the group (I expect the group size to be a maximum of 5-10) 2)any message generated by any computer will be sent to every other node (this is the main requirement and I have short messages which need to be sent in shortest possible time: suggest network layer protocol to be used here), message wont be resent or ack (except leave)..but I still want to maintain high reliability, can I maintain it without receiving acks?

one problem would be to communicate on the internet I will need some sort of NAT support? how can this be managed without a stun server?

Should I use a p2p library? as I think most of the features they offer wont be needed by me could anyone suggest some here?

I'm working in C++.

1
  • It might interest ZeroMQ for c++ and the guide. Even if you don't implement ZeroMQ, the patterns might help you to find out which IPC you need or which one fits best in your needs.
    – Laiv
    Commented Jun 10, 2020 at 12:43

4 Answers 4

1

2 ways I see:

  • Classic client/server model with UDP connections
  • P2P model

Client/server is the easiest since you don't have to worry about port forwarding.

Pick whichever is best for your app

1
  • Client/server is the one for me too. Could not agree more
    – Gus
    Commented Jul 15, 2011 at 15:50
0

Why not just use TCP? The server can be a simple relay server or an off-the-shelf IRC server. Do you have some kind of critical latency requirement? Or high throughput requirement? If not, I would just pull the server off the shelf.

1
  • +1 for suggesting an existing off-the-shelf solution that matches the requirements (one could argue that IRC doesn't fulfill "shortest possible time", but no real world implementation of anything would match that criterion)
    – Helena
    Commented Oct 3, 2021 at 15:42
0

No acks means TCP is out. Maintaining high reliability means UDP is not enough on it's own. No resending means errors cannot be fixed on demand.

What you can do under these requirements is send out a parity bit, cyclic redundancy check, or hash (depends on your needs) that will help you detect the error. While this doesn't let you fix the error, it does ensure you wont treat it as good data when it isn't.

Another trick is to number your packets that are meant to go together. When holes are left you can tell that packets have been lost after a reasonable time out.

These can be built on top of UDP. Just have to add the extras to get the reliability you need.

-2

You could have a look at ZeroMQ. It's basically a very efficient message queue with support for different transport protocols. Besides others, it implements a Publish-Subscribe model where a node can publish messages that will be received by all subscriber nodes. It is very lightweight and it works on Windows, Linux and Mac. Maybe this is a good starting point...?

Note that there is also a Qt binding (nzmqt) for it (just in case you want to use Qt for your project).

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