center = ServerCenter([location + ':4405']) center.connect(location) if type == "udpserver": center = ServerCenter([location + ':4405d']) PSYCUNI(location + ':4405/~fool', center) if type == "udpclient": # this should better be done via a Center which can parse # URLs and them handle according to their transport # but for a quick udp sender this is okay... q = PSYCUDPSender(location + ':4405d') q.msg({'_target' : 'psyc://adamantine.aquarium:d/~fippo'}, {'_nick' : 'udpclient'}, '_message_private', 'hallo udp welt') if type == "client": center = ClientCenter() PSYCObject('psyc://adamantine.aquarium', center) # maybe add config information here? # and let this thing connect as well? me = PSYCClient('psyc://adamantine.aquarium/~fippo', center) me.online() # but thats the fast way to do it me.sendmsg({'_target' : 'psyc://adamantine.aquarium/~fippo'}, {'_password' : 'xfippox'}, '_request_link', '') while center: asyncore.poll(timeout=0.5)
"""p2p manager and client as described in the old PSYC whitepaper at http://psyc.pages.de/whitepaper/ probably broken currently""" from pypsyc.center import ServerCenter, ClientCenter from pypsyc.objects.PSYCObject import PSYCClient from pypsyc.objects.Advanced import AdvancedManager, AdvancedPlace import sys import asyncore location = 'psyc://adamantine.aquarium' type = sys.argv[1] if type == 'manager': center = ServerCenter([location + ':4405/', location + ':4406', location + ':4407', location + ':4408']) center2 = ServerCenter([location]) AdvancedManager(location + '/@advanced', center2) if type == 'client': center = ClientCenter() me = PSYCClient(location + '/~fippo', center) me.online() AdvancedPlace(location + "/@advanced", center) me.sendmsg({'_target' : location + '/@advanced', '_source' : location + '/~fippo'}, '_request_enter', '') while center: asyncore.poll(timeout=0.5)
def __init__(self, netname, center): PSYCClient.__init__(self, netname, center) self.display = None self.extra_display = {} # XXX #self.create_display(parent=None) print 'default_conmnect is --> ' + self.center.default_connection