def initialiseComponent(self):
      import random
      clientServerTestPort=random.randint(1500,1599)
      server=_SimpleServer(protocol=_Chargen, port=clientServerTestPort).activate()
      self.server=server
      self.addChildren(server)

      conecho = _ConsoleEchoer()
      self.addChildren(conecho)

      client=_TCPClient("127.0.0.1",clientServerTestPort)
      self.addChildren(client)
      self.link((client,"outbox"), (conecho,"inbox"))
      return _Axon.Ipc.newComponent(*(self.children))
Example #2
0
    """ prints received text
    """     
    def main(self):
        while 1:
            yield 1
            while self.dataReady("inbox"):
                print "datasink received:", self.recv("inbox")

import sys
if __name__=="__main__":
    if len(sys.argv) != 4:
        print "Usage:", sys.argv[0], "kpiserver port usercfg"
        print "default values used: kpiserver=localhost, port=1256 and usercfg = user3"
        server = "localhost"
        port = 1256
        usercfg = "user3"
    else:
        server = sys.argv[1]
        port = int(sys.argv[2])
        usercfg = sys.argv[3]

    Graphline(
        #c=KPIClient(usercfg, consoleEchoer()),
        c=KPIClient(usercfg, MyDataSink()),
        cc = _TCPClient(server,port),
        linkages = {
            ("c","outbox") : ("cc","inbox"),
            ("cc","outbox") : ("c","inbox"),
        }
    ).run()
Example #3
0
    """ prints received text
    """
    def main(self):
        while 1:
            yield 1
            while self.dataReady("inbox"):
                print "datasink received:", self.recv("inbox")


import sys
if __name__ == "__main__":
    if len(sys.argv) != 4:
        print "Usage:", sys.argv[0], "kpiserver port usercfg"
        print "default values used: kpiserver=localhost, port=1256 and usercfg = user3"
        server = "localhost"
        port = 1256
        usercfg = "user3"
    else:
        server = sys.argv[1]
        port = int(sys.argv[2])
        usercfg = sys.argv[3]

    Graphline(
        #c=KPIClient(usercfg, consoleEchoer()),
        c=KPIClient(usercfg, MyDataSink()),
        cc=_TCPClient(server, port),
        linkages={
            ("c", "outbox"): ("cc", "inbox"),
            ("cc", "outbox"): ("c", "inbox"),
        }).run()
Example #4
0
                            return newComponent(myServer)

                        elif clickedReset == True:
                            clickedReset = False
                            sys.exit()

        elif self.demo_mode == False:
            myServer = SimpleServer(self.protocol, self.port)
            self.addChildren(myServer)
            return newComponent(myServer)
        return 1


if __name__ == "__main__":
    from Kamaelia.SimpleServerComponent import SimpleServer

    protocol = ServerProtocolHandler
    port = 1616
    demo_mode = True

    UserInterface(protocol, port, demo_mode).activate()

    import sys
    sys.path.append("../Layout")
    from Kamaelia.Utils.Introspector import Introspector
    from Kamaelia.Internet.TCPClient import TCPClient as _TCPClient
    from Kamaelia.Util.PipelineComponent import pipeline
    pipeline(Introspector(), _TCPClient("127.0.0.1", 1500)).activate()

    scheduler.run.runThreads(slowmo=0)
Example #5
0
                    self.addChildren(myServer)
                    return newComponent(myServer)
                    
                 elif clickedReset == True:
                    clickedReset = False
                    sys.exit()
                
      elif self.demo_mode == False:
         myServer = SimpleServer(self.protocol, self.port)
         self.addChildren(myServer)
         return newComponent(myServer)
      return 1       
            
if __name__ == "__main__":
   from Kamaelia.SimpleServerComponent import SimpleServer
   
   protocol=ServerProtocolHandler
   port=1616
   demo_mode = True

   UserInterface(protocol, port, demo_mode).activate()
   
   import sys
   sys.path.append("../Layout")
   from Kamaelia.Utils.Introspector import Introspector
   from Kamaelia.Internet.TCPClient import TCPClient as _TCPClient
   from Kamaelia.Util.PipelineComponent import pipeline
   pipeline(Introspector(),_TCPClient("127.0.0.1",1500)).activate()
   
   scheduler.run.runThreads(slowmo=0)