views:

89

answers:

2

Hi,

I'm using C++ to develop the server side of a game which multiple servers need to communicate with each other using Publisher/Subscriber pattern. Each server subscribes to some events on different servers. All servers are located on the same network so latency and packet-loss should be very low. The inter-server communication should be as efficient as possible since many events happen each second.

Are there any libraries out there i can use for this purpose?

Any help is much appreciated

+1  A: 

You're essentially talking about a socket library. That's different from IPC, which refers to Interprocess Communication between two or more processes on the same computer - as opposed to over a network. Network communication requires socket programming, so you probably want a good, high-performance socket library. Boost.ASIO is a very good C++ portable socket library which provides both TCP and UDP sockets.

Charles Salvia
In fact, IPC can mean both: communication of multiple processes on the same computer or one multiple computers, connected via network. Nevertheless, TCP/IP sockets are the tool of choice for that.
Dubu
+1  A: 

You should be able to combine Boost.ASIO (for async sockets I/O) with Boost.Signals (for Observer pattern) or Boost.Signals2 (threadsafe version of Boost.Signals) to achieve what you want.

There is a simple example showing how this might work here. Note that this uses a wrapper on Boost.Signal, but you get the idea.

Steve Townsend