declare [P2PClient TwikiStore] = {Module.link ['x-ozlib://keving/net/p2p/P2PKitClient.ozf' 'x-ozlib://keving/net/TwikiStore.ozf']} %% If argument is error then raise it as an exception %% If success then return content fun {GetS R} thread case R of error(E) then {Value.failed E} [] success(S) then S end end end %% As GetS, but throws away any success value and kills app on exception proc {GetS_ R} thread case R of error(E) then raise E end [] success(...) then skip end end end end %%OzStoreTicket = unit OzStoreTicketFile = 'http://localhost/~keving/OzStoreTicket' %OzStoreTicketFile = 'http://www.info.ucl.ac.be/~glynn/OzStoreTicket' OzStore = true OzStoreTicket = if OzStore then OzStoreTicket={Pickle.load OzStoreTicketFile} else unit end GetTwikiCacheURL = 'http://renoir.info.ucl.ac.be/twiki/pub/INGI/TwikiCache/' Network='keving' %%Network='default' Verbose=10 declare %% Retrieve p2p network entry points ClientEntryPoints = {Map if OzStore then {GetS {Send {Connection.take OzStoreTicket} get(Network $)}} else {TwikiStore.get GetTwikiCacheURL Network} end fun {$ _#(_#_#C)} C end} declare NWHandle = {GetS {P2PClient.makeClient ClientEntryPoints Verbose}} {System.show 'joined network'} {Property.put 'print.width' 1000} {Property.put 'print.depth' 1000} MyPeerId = {NWHandle getPeerId($)} % %% %% ZeroDSM: Zero all entries in DSM %% declare local fun {Maker Env} [System P2PKitPeer] = {Env resolve_module_list(['System' 'P2PKitPeer'])} [MyNodeId] = {Env resolve_constant_list(['NodeId'])} SetColour = {Env resolve_proc('SetColour')} %% Attach to local DSM Result = {P2PKitPeer.rpcPeer MyNodeId dsm_manager getDSM $} in {System.show 'XXXXXXXXXX Installing DSM Zeroizer XXXXXXXXX'} case Result of success(dsm(dsm:DSM)) then {System.show 'waiting ....'} {Wait DSM} {System.show 'mydsm :'#DSM} [] error(E) then {System.show 'error :'#E} end desc(processor: proc {$ M} success(dsm(dsm:DSM)) = Result Msg = M.msg in case Msg of go(N V) then for I in 0..N do {DSM write(I V)} end [] dump(N) then for I in 0..N do Val = {DSM read(I $)} in {System.showInfo I#' = '#Val} end end end) end in ZeroDSM = {GetS {NWHandle installService(maker: Maker handle: $)}} end {GetS_ {ZeroDSM peer(id: MyPeerId message:go(101 23891))}} {GetS_ {ZeroDSM broadcast(message:dump(101))}}