Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Synchronous message transmission

Synchronous message transmission

Scheduled Pinned Locked Moved The Lounge
comtutorialquestion
21 Posts 15 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Chris Maunder

    Attach post-it notes to each message with the order that each message should be read. Before you send the message send a stern message telling the recipient to read the following messages in order. Do not send any messages until you have timid aquisition from the recipient. Do not proceed with any messages if you run out of post-it notes half way though

    cheers, Chris Maunder

    CodeProject.com : C++ MVP

    D Offline
    D Offline
    Douglas Troy
    wrote on last edited by
    #5

    When Marc said something about using "pipes" ... I think you've used the wrong kind ... ;P


    :..::. Douglas H. Troy ::..
    Bad Astronomy |VCF|wxWidgets|WTL

    1 Reply Last reply
    0
    • M martin_hughes

      Do you have any specific network protocol in mind? My guess is no and that such things are implemented within an application layer of some sort.

      Me: Can you see the "up" arrow? User:Errr...ummm....no. Me: Can you see an arrow that points upwards? User: Oh yes, I see it now! -Excerpt from a support call taken by me, 08/31/2007

      M Offline
      M Offline
      Marc Clifton
      wrote on last edited by
      #6

      martin_hughes wrote:

      Do you have any specific network protocol in mind? My guess is no and that such things are implemented within an application layer of some sort.

      Correct. No protocol in mind, and that's what I figured as well. Marc

      Thyme In The Country
      Interacx
      My Blog

      1 Reply Last reply
      0
      • M Marc Clifton

        Is there a protocol that guarantees the order of messages? Not packets, I mean messages (consisting of multiple packets). For example, I want to be able to send msg1, msg2, msg3 and receive them in that order. But here's the catch, the sender can't (yes, really, it can't) send them synchronously, waiting for a message acknowledgement. So, is there a messaging protocol that guarantees delivery in a particular order for messages? Maybe named pipes (a pipe seems like the right concept)? Marc

        Thyme In The Country
        Interacx
        My Blog

        Y Offline
        Y Offline
        Yortw
        wrote on last edited by
        #7

        It may be too heavy a solution for you, but MSMQ (Microsoft Message Queue) using transactional queues should provide this functionality.

        N 1 Reply Last reply
        0
        • M Marc Clifton

          Is there a protocol that guarantees the order of messages? Not packets, I mean messages (consisting of multiple packets). For example, I want to be able to send msg1, msg2, msg3 and receive them in that order. But here's the catch, the sender can't (yes, really, it can't) send them synchronously, waiting for a message acknowledgement. So, is there a messaging protocol that guarantees delivery in a particular order for messages? Maybe named pipes (a pipe seems like the right concept)? Marc

          Thyme In The Country
          Interacx
          My Blog

          D Offline
          D Offline
          Dario Solera
          wrote on last edited by
          #8

          Never heard of anything like that, but one never knows... Anyway, I think that it shouldn't be very difficult to design a protocol like that. I think it's sufficient to add a timestamp on each message, and the receiver just needs to sort them by time. Or am I missing something?

          If you truly believe you need to pick a mobile phone that "says something" about your personality, don't bother. You don't have a personality. A mental illness, maybe - but not a personality. - Charlie Brooker My Blog - My Photos - ScrewTurn Wiki

          W 1 Reply Last reply
          0
          • M Marc Clifton

            Is there a protocol that guarantees the order of messages? Not packets, I mean messages (consisting of multiple packets). For example, I want to be able to send msg1, msg2, msg3 and receive them in that order. But here's the catch, the sender can't (yes, really, it can't) send them synchronously, waiting for a message acknowledgement. So, is there a messaging protocol that guarantees delivery in a particular order for messages? Maybe named pipes (a pipe seems like the right concept)? Marc

            Thyme In The Country
            Interacx
            My Blog

            G Offline
            G Offline
            Gary R Wheeler
            wrote on last edited by
            #9

            I don't get it. Doesn't TCP/IP sockets get you this? Messages between a given sender and receiver are guaranteed to be in order.


            Software Zen: delete this;

            Fold With Us![^]

            M 1 Reply Last reply
            0
            • G Gary R Wheeler

              I don't get it. Doesn't TCP/IP sockets get you this? Messages between a given sender and receiver are guaranteed to be in order.


              Software Zen: delete this;

              Fold With Us![^]

              M Offline
              M Offline
              Marc Clifton
              wrote on last edited by
              #10

              Gary R. Wheeler wrote:

              Messages between a given sender and receiver are guaranteed to be in order.

              I'm still puzzling over whether that is true, especially if each message is sent within the context of its own socket connection. Marc

              Thyme In The Country
              Interacx
              My Blog

              G G 2 Replies Last reply
              0
              • M Marc Clifton

                Gary R. Wheeler wrote:

                Messages between a given sender and receiver are guaranteed to be in order.

                I'm still puzzling over whether that is true, especially if each message is sent within the context of its own socket connection. Marc

                Thyme In The Country
                Interacx
                My Blog

                G Offline
                G Offline
                Gunni
                wrote on last edited by
                #11

                I think Gary's right, considering the way TCP works (sending whole messages and not returning until the whole thing has been ACK'd) it seems to me that you have a pretty good guarantee right there. If you had to use UDP for whatever reason you'd have to do some thinking involving maybe embedding serial numbers into your messages but since UDP doesn't guarantee delivery it would be pretty useless I think. So to sum up: Yeah TCP should guarantee you get the messages in the right order. I took a computer networking course last semester so this stuff is still pretty fresh in my head :cool: hth

                1 Reply Last reply
                0
                • M Marc Clifton

                  Is there a protocol that guarantees the order of messages? Not packets, I mean messages (consisting of multiple packets). For example, I want to be able to send msg1, msg2, msg3 and receive them in that order. But here's the catch, the sender can't (yes, really, it can't) send them synchronously, waiting for a message acknowledgement. So, is there a messaging protocol that guarantees delivery in a particular order for messages? Maybe named pipes (a pipe seems like the right concept)? Marc

                  Thyme In The Country
                  Interacx
                  My Blog

                  M Offline
                  M Offline
                  MCEdwards
                  wrote on last edited by
                  #12

                  It seems to me that if each message is being send async over different sockets you are going to need some way of identifying which sets of messages are related, the order in which they are meant to arrive and the total number to expect. The simplest solution I can think of is to create a message header that details this information. The receiving system should then be able store incomplete message sets and wait until the total number of messages has arrived before sorting them by message order. The receiver will need to be designed to be able to handle multiple sets of messages being sent at the same time to avoid data clashes. I would also add some sort of check sum if the data is going over a public network to ensure that no one has tried to inject messages into the system.

                  B 1 Reply Last reply
                  0
                  • D Dario Solera

                    Never heard of anything like that, but one never knows... Anyway, I think that it shouldn't be very difficult to design a protocol like that. I think it's sufficient to add a timestamp on each message, and the receiver just needs to sort them by time. Or am I missing something?

                    If you truly believe you need to pick a mobile phone that "says something" about your personality, don't bother. You don't have a personality. A mental illness, maybe - but not a personality. - Charlie Brooker My Blog - My Photos - ScrewTurn Wiki

                    W Offline
                    W Offline
                    W Balboos GHB
                    wrote on last edited by
                    #13

                    Dario Solera wrote:

                    I think it's sufficient to add a timestamp on each message, and the receiver just needs to sort them by time.

                    Alas, you're missing one small point: althought the time stamps would indeed sort the messages in the order sent - what's to guarantee that no message is missing from the sequence? They'd still be sorted temporally. Maybe the solution is to send one great big message!

                    "The difference between genius and stupidity is that genius has its limits." - Albert Einstein

                    K S 2 Replies Last reply
                    0
                    • M Marc Clifton

                      Is there a protocol that guarantees the order of messages? Not packets, I mean messages (consisting of multiple packets). For example, I want to be able to send msg1, msg2, msg3 and receive them in that order. But here's the catch, the sender can't (yes, really, it can't) send them synchronously, waiting for a message acknowledgement. So, is there a messaging protocol that guarantees delivery in a particular order for messages? Maybe named pipes (a pipe seems like the right concept)? Marc

                      Thyme In The Country
                      Interacx
                      My Blog

                      T Offline
                      T Offline
                      TomGarth
                      wrote on last edited by
                      #14

                      What Yortw said: It may be too heavy a solution for you, but MSMQ (Microsoft Message Queue) using transactional queues should provide this functionality. That functionality is built into MSMQ.

                      Tom Garth Developer R. L. Nelson and Associates, Inc., Virginia

                      1 Reply Last reply
                      0
                      • W W Balboos GHB

                        Dario Solera wrote:

                        I think it's sufficient to add a timestamp on each message, and the receiver just needs to sort them by time.

                        Alas, you're missing one small point: althought the time stamps would indeed sort the messages in the order sent - what's to guarantee that no message is missing from the sequence? They'd still be sorted temporally. Maybe the solution is to send one great big message!

                        "The difference between genius and stupidity is that genius has its limits." - Albert Einstein

                        K Offline
                        K Offline
                        King_Of_All_Idiots
                        wrote on last edited by
                        #15

                        Normally just add an ID to the protocol. Each message starts at 1 and counts up. What layer 2 communication are you using? Ethernet, RS232, CAN, USB? TCP/IP does this for you. If you use UDP/IP then it's up to you. A typical protocol will have a header consisting of the senders ID, amount of bytes in the packet,Time stamp,receivers ID, packet counter, ect.. Followed by bytes of data and ending with a CRC checksum to guarantee that the data was not corrupted during transmission. Steve

                        W 1 Reply Last reply
                        0
                        • W W Balboos GHB

                          Dario Solera wrote:

                          I think it's sufficient to add a timestamp on each message, and the receiver just needs to sort them by time.

                          Alas, you're missing one small point: althought the time stamps would indeed sort the messages in the order sent - what's to guarantee that no message is missing from the sequence? They'd still be sorted temporally. Maybe the solution is to send one great big message!

                          "The difference between genius and stupidity is that genius has its limits." - Albert Einstein

                          S Offline
                          S Offline
                          Snnu
                          wrote on last edited by
                          #16

                          aha, you can add some fiedds in your message to index the order of the pkt1, pk2,..., and the totle number of the packets. If you use TCP protocl, then you don't worry the miss the packet.

                          W 1 Reply Last reply
                          0
                          • M Marc Clifton

                            Gary R. Wheeler wrote:

                            Messages between a given sender and receiver are guaranteed to be in order.

                            I'm still puzzling over whether that is true, especially if each message is sent within the context of its own socket connection. Marc

                            Thyme In The Country
                            Interacx
                            My Blog

                            G Offline
                            G Offline
                            Gary R Wheeler
                            wrote on last edited by
                            #17

                            Let me put it this way. The product I work on sends megabytes of print data and thousands of control and status messages per second around a multiprocessor/multicomputer high-speed ink jet printing system, all using TCP/IP over gigabit Ethernet. Message order is A Big Thing. If messages get out of order we screw up the print data, spray ink on the floor, or kill the operator with the world's worst paper cut (we move paper at 17 feet per second).

                            Marc Clifton wrote:

                            each message is sent within the context of its own socket connection

                            There you go, changing the rules. If each message gets its own connection (even though the sender and the receiver are the same), then all bets are off, since the message order is managed by (or at least a behavior of) the connection. Truth is, they will still probably be sequential, given all the overhead required to establish the connection, send the message, break the connection, repeat. This pattern is much more like UDP, which doesn't guarantee message delivery or order.


                            Software Zen: delete this;

                            Fold With Us![^]

                            1 Reply Last reply
                            0
                            • Y Yortw

                              It may be too heavy a solution for you, but MSMQ (Microsoft Message Queue) using transactional queues should provide this functionality.

                              N Offline
                              N Offline
                              nick_dowling
                              wrote on last edited by
                              #18

                              And the advantage of this is that if you are using Microsoft servers and .Net then there is no further financial outlay to use MSMQ. But if you are in a large organisation you may find they have standardised on another similar product such as IBM's MQ series or Tibco Rendezvous. Nick

                              1 Reply Last reply
                              0
                              • K King_Of_All_Idiots

                                Normally just add an ID to the protocol. Each message starts at 1 and counts up. What layer 2 communication are you using? Ethernet, RS232, CAN, USB? TCP/IP does this for you. If you use UDP/IP then it's up to you. A typical protocol will have a header consisting of the senders ID, amount of bytes in the packet,Time stamp,receivers ID, packet counter, ect.. Followed by bytes of data and ending with a CRC checksum to guarantee that the data was not corrupted during transmission. Steve

                                W Offline
                                W Offline
                                W Balboos GHB
                                wrote on last edited by
                                #19

                                Which am I using? None of the above (in this context). All I was pointing out (in my reply) was that sorting by time (alone) doesn't guarentee that all messages will be read in order. Only those received. w.r.t. you post: Is there more than one time stamp. By this, I mean, does the user system create the time stamp or the server. And, really in either case, can one be sure they are all synchronized (I think this was to come from more than one possible sending unit). A tag seems to be a good idea (so long as the tags coordinate, but then, the clocks could be synched). I don't know much about the communication protocols, so will defer to your expertise. Steve (too).

                                "The difference between genius and stupidity is that genius has its limits." - Albert Einstein

                                1 Reply Last reply
                                0
                                • S Snnu

                                  aha, you can add some fiedds in your message to index the order of the pkt1, pk2,..., and the totle number of the packets. If you use TCP protocl, then you don't worry the miss the packet.

                                  W Offline
                                  W Offline
                                  W Balboos GHB
                                  wrote on last edited by
                                  #20

                                  I believe he was referring to entire messages (that's the context I was answering to) - not packets. What I hoped I had expressed was that sorting incoming messages by time sent doesn't guarantee that you've not missed one or messages in the sequence. I didn't even address synchonization of all the clocks from the sending units (if there is more than one).

                                  "The difference between genius and stupidity is that genius has its limits." - Albert Einstein

                                  1 Reply Last reply
                                  0
                                  • M MCEdwards

                                    It seems to me that if each message is being send async over different sockets you are going to need some way of identifying which sets of messages are related, the order in which they are meant to arrive and the total number to expect. The simplest solution I can think of is to create a message header that details this information. The receiving system should then be able store incomplete message sets and wait until the total number of messages has arrived before sorting them by message order. The receiver will need to be designed to be able to handle multiple sets of messages being sent at the same time to avoid data clashes. I would also add some sort of check sum if the data is going over a public network to ensure that no one has tried to inject messages into the system.

                                    B Offline
                                    B Offline
                                    bwilhite
                                    wrote on last edited by
                                    #21

                                    For what it's worth this is how it's handled in the world of banking and finance. The FIX protocol uses message headers and numbers and such, very much like described here.

                                    1 Reply Last reply
                                    0
                                    Reply
                                    • Reply as topic
                                    Log in to reply
                                    • Oldest to Newest
                                    • Newest to Oldest
                                    • Most Votes


                                    • Login

                                    • Don't have an account? Register

                                    • Login or register to search.
                                    • First post
                                      Last post
                                    0
                                    • Categories
                                    • Recent
                                    • Tags
                                    • Popular
                                    • World
                                    • Users
                                    • Groups