How to get a multicast to wait for all nodes?

Ryuke ThuongqDo at gmail.com
Fri Jun 27 22:49:42 CEST 2008


On Jun 27, 8:09 am, "Colin J. Williams" <c... at ncf.ca> wrote:
> Ryuke wrote:
> > I have a code that receives gps information from nodes and gives off
> > its own coordinates via radios connected by Ethernet.  but the code
> > continues to run after receiving only 1 set of coordinates, how do i
> > get it to wait for multiple nodes to send before continuing
>
> You might provide wth significant part
> of the code you have written.
>
> Colin W.


oops. guess that's important, here's part of it

#Get local node network view data from RIB using SNMP over Ethernet
        mynodeID = snmpget(RIB_HOST, MYNODE_ID)
#        print '[netge module] MYnode ID =',mynodeID
        netdict = snmpwalk(RIB_HOST,MIB_BASE)
        netdict[MYNODE_ID] = mynodeID
        print '[netge module] MyNode ID = ',netdict[MYNODE_ID]

        sorted_keys = sorted(netdict)
#        for key in sorted_keys: print '%s\t\t%s' % (key,netdict[key])
        for c in netdict[NODE_LIST][1:]: print '[netge module] NbrNode
%d'% ord(c)

        #Create heart beat data packet for multicast xfer
#        gpsdata.append(time.ctime())
        print '[netge module] mynode location =
',netdict[MYNODE_LOCATION]
#        netdict[MYNODE_LOCATION] = ' '.join(gpsdata)
        netdict[MYNODE_LOCATION] = gpsdata
        print '[netge module] mynode location =
',netdict[MYNODE_LOCATION]
        heartbeat = ' '.join(netdict[MYNODE_LOCATION])
        print '[netge module] heartbeat=',heartbeat

        #Send mulitcast heart beat packet of local node view of
network
        sock.sendto(heartbeat,(MULTICAST_IP_ADDR, MULTICAST_PORT))
        print '[netge module] multicast send'

        #Receive mulitcast heart beat data
        #ReceiveHB()
        print '[netge module] multicast receive=',sock.recv(1024)

        #Create KMZ file for local node view of network
#        CreateKMZfile(netdict)

        node = []
        latitude = []
        longitude = []
        altitude = []
        kml_nodes = ''
        kml_links = ''

        MAX_NUM = int(netdict[NUMBEROFNODES])
#        MAX_NUM = len(netdict[NODE_LIST])
#        print MAX_NUM



More information about the Python-list mailing list