Thread: connection oriented or message oriented pipe server?

  1. #1
    Registered User
    Join Date
    Apr 2011

    Question connection oriented or message oriented pipe server?


    I am currently working on a windows service which is talking to multiple instances of another program. The number of client instances is not fixed and changing dynamically. However the maximum number is relatively low, below 20, and the service can handle the load easily.
    The programs are sending messages about every five seconds. These messages are nothing more than simple structs containing two DWORDs, so:

    struct msg{
    DWORD dwThreadId;
    DWORD dwEventId;
    Since every instance is alive over a longer period of time and will send hundreds of messages I wonder if it is better to keep this message oriented approach or switch to a connection oriented approach. I could imagine assigning one instance of the named pipe to one client. So the pipe instance would determine the client's thread id, while the client will not send msg structs, but only the event ids.

    In this scenario it will probably have no major impact, but if we assume the clients would send multiple messages per second, I believe a connection oriented approach would be more efficient. The overhead to create a pipe instance is reduced to one time as well as the message traffic is reduced by 50% since only one DWORD needs to be sent.
    Both approaches can easily be multithreaded since either a thread is spawned for processing every message, or one thread is spawned for processing and managing one single pipe. If an client is terminated, the piple will be closed.

    I wonder if named pipes on Windows are suited for this sort of communication? It appears to me the connection oriented approach is the cleaner, overall more efficient one...

    Last edited by curiosity; 06-28-2011 at 02:02 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Object Oriented C
    By CSaw in forum C Programming
    Replies: 6
    Last Post: 07-06-2011, 05:06 AM
  2. Object oriented SDL
    By jamort in forum Game Programming
    Replies: 3
    Last Post: 01-31-2011, 09:07 AM
  3. new to object oriented!!!!
    By salmanriaz in forum C++ Programming
    Replies: 2
    Last Post: 03-12-2009, 07:43 AM
  4. object oriented C
    By FlatLost in forum C Programming
    Replies: 4
    Last Post: 11-08-2005, 06:22 AM
  5. Replies: 1
    Last Post: 01-07-2002, 12:17 PM

Tags for this Thread