[Cse461] Re: Question on Link Info Packing/Unpacking

From: Janet Davis (jlnd_at_cs.washington.edu)
Date: Tue Feb 03 2004 - 11:53:12 PST

  • Next message: Janet Davis: "Re: [Cse461] Name conventions"

    On Tue, 3 Feb 2004, Lee Murphy wrote:

    > Well, the main question is how does it work. I don't know if it is a Ruby
    > issue, but when we try to pass our list of neighbors and pack it we get
    > gibberish back out. It seems we should pass an array with each entry
    > being a neighbor, but I remember being told that arrays were to slow to
    > work with. Will a Hash work here too? So I guess my question is in what
    > format should we pass our neighbor list to the LinkState pack function in?

    You're correct, the neighbor list you use to create a LinkState object
    should be an array with each entry being a neighbor's address. An array
    is a reasonable format for sending the list of neighbors over the network
    -- you can always convert to something more efficient for computations
    such as Dijkstra's algorithm if you wish.

    I'm not surprised the packed LinkState object looks like gibberish -- it's
    intended to pack the data into a small number of bytes, not to generate
    something human-readable. Sorry for any confusion about this.

    On the sending side, use
      msg = link_state.pack
    to pack the LinkState object.

    On the receiving side, use
      link_state = LinkState.unpack(msg)
    to unpack the LinkState object.

    Hope this helps!

    Cheers,
    Janet

    -- 
    Janet Davis
    jlnd_at_cs.washington.edu
    http://www.cs.washington.edu/homes/jlnd/
    _______________________________________________
    Cse461 mailing list
    Cse461_at_cs.washington.edu
    http://mailman.cs.washington.edu/mailman/listinfo/cse461
    

  • Next message: Janet Davis: "Re: [Cse461] Name conventions"

    This archive was generated by hypermail 2.1.6 : Tue Feb 03 2004 - 11:53:16 PST