Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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++.

share|improve this question

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.

share|improve this answer

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

share|improve this answer
Client/server is the one for me too. Could not agree more – Gus Jul 15 '11 at 15:50

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).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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