UNIX Socket FAQ

A forum for questions and answers about network programming on Linux and all other Unix-like systems

You are not logged in.

  • Index
  • » C
  • » Advanced example of Unix Domain Socket

#1 2011-05-01 07:52 PM

rcbandit
Member
Registered: 2011-05-01
Posts: 2

Advanced example of Unix Domain Socket

Hi,
  I'm beginner C developer. I'm working on a open source project which uses Unix Domain Socket in order modules to communicate each other. The idea is this:
   I have 4 modules which run as Linux daemons. One daemon acts as kernel. His only task is to forward the messages between the modules. Messages are only simple JSON strings. Is there some similar solution? I'm looking for some source code which similar?
   I have created multithreaded Unix Domain socket server and client but the problem is in the switch system which must recognize the messages and send them to the appropriate destination module.
   Is this a good software design? Is there a weak design?

Thank you in advance!

Regards
Peter

Offline

#2 2011-05-02 11:55 AM

RobSeace
Administrator
From: Boston, MA
Registered: 2002-06-12
Posts: 3,829
Website

Re: Advanced example of Unix Domain Socket

I'm really not sure what you're asking exactly...  Are Unix domain sockets appropriate for such a use?  Sure they are...  They're not your only option, but they may be the easiest/best choice, depending on your needs...

As for your "problem", I don't understand what it is exactly...  Why are you having trouble identifying the messages and where to redirect them?  If you post some code and explain your problems better, we'll probably be able to help...

Offline

#3 2011-05-02 12:08 PM

rcbanditz
Guest

Re: Advanced example of Unix Domain Socket

I'm looking for implementation of daemons which use Unix domain Socket to send and receive messages each other. Can anyone paste here an example?

Regards
Peter

#4 2011-05-02 09:11 PM

RobSeace
Administrator
From: Boston, MA
Registered: 2002-06-12
Posts: 3,829
Website

Re: Advanced example of Unix Domain Socket

If you're just looking for generic Unix domain example code, get the example source for Stevens' Unix Network Programming book...  That's got examples of just about everything sockets-related (and some non-sockets stuff), including Unix domain sockets...

Offline

#5 2012-01-12 03:09 AM

Jeremy
Guest

Re: Advanced example of Unix Domain Socket

Sounds like your "kernel" daemon needs to parse the JSON strings to determine their destination. You may also need to modify the protocol so that the clients identify themselves when they connect.

  • Index
  • » C
  • » Advanced example of Unix Domain Socket

Board footer

Powered by FluxBB