IPCSocket, Multiple Linux Stand Alone WE apps talking to each other (New to Sockets)

I’m currently looking into IPCSockets and how I could use it to have multiple SA(Stand alone) WE apps talk to each other on the same server. They are multiple instances of the same app behind HAProxy…
Am I correct when thinking that one socket can only have one connection at a time?
Should I build a “server” app that holds one socket per WE app that in turn relays a received message to all other sockets?

Any clever ideas on how to build this kind of local app communication? :slight_smile:
Keep in mind…I’m new to sockets and app communication.

All sockets connect between one program and another, not just IPCSockets. That said, you’ll probably have better luck using a ServerSocket for your purpose and just have them connect on localhost.

Have the app be able to go either way. On startup, try to connect. If you get a connection, then there is already a Server and you are a Client. If not, then set up a ServerSocket and start listening. You are now the Server. Subsequent instances of the app will become Clients.

ServerSockets can’t serve IPCSockets.

Thanks Tim and Greg!
I’ll try without a helper app and see how it goes.
I still need an array of sockets right. One for each app?

If you’ll be using tcpsockets, you can use a ServerSocket. That will keep track of the sockets for you. Just subclass tcpsocket, and return an instance in the AddSocket event.

Return New MyTcpSocket

I ended up creating a console app with a ServerSocket that acts as the server who the WE apps connect to using TCPSockets.
Messages are received at the server and forwarded to the connected apps.

Thanks for the input guys :slight_smile: