parsing data communication RRS feed

  • Question

  • Hi guys,

    I want to have a question regarding to an architecture and implementation:

    For example, I have this class diagram:

    SocketComm (1)--- has ----->(1) FirstParser -- has ----> (n) Unit

    - SocketComm: is a TCP/IP socket server receiving data

    - FirstParser: is to check this socket data is belonged to which unit

    - Units: parsing data 

    === Functions ===

    in SocketComm: is a TCP/IP socket server receiving data and put them in a list FirstParser.Queue.Add(Newdata)

    in FirstParser: is a timer which ticks every 1 millisecond to check is there any item in the queue. If yes, then check which newdata is belonged to which unit

    in Unit: is a timer which ticks every 1 millisecond to start its communication with the device


    So there is one timer in FirstParser and multiple timers in Unit class.

    Would anybody please give me some advices about this architecture and also the way of using number of timers for implementing?

    Thanks in advance.

    Friday, May 20, 2011 10:00 AM

All replies

  • I am not sure whether I have understood your case correctly but I would propose some solution. One can think of using publisher- subscriber pattern. The queue would act as publisher and First Parser  would act as subscriber and also Frist Parser as a publisher and all Units as subscribers. When socket server puts the data in queue, the queue would notify First Parser about arrival of new data which in turn would decide which Unit to swing in action and notify corresponding Unit accordingly.This solution would eliminate need of pinging the queue with set time intervals and action would be triggered when some data has arrived into the queue.

    Hope this helps.

    • Proposed as answer by Vishvvas Thursday, May 26, 2011 7:32 AM
    Thursday, May 26, 2011 7:03 AM